RuntimeError: ERROR C22P02 Minvalid input syntax for integer: "—
records = Asset.find_all_by_tracking_id(prod[:tracking_id])
–
We develop, watch us RoR, in numbers too big to ignore.
That worked great!! Thanks alot Mark. I’ve been stuck on that all day.
When the form submits, Im trying to save a foreign key (medprocedure_id)
in the asset table for each of the tracking_id’s in the form. Almost
have it working, however, its not saving the foreign key for all the
records. Only for the last one.
Heres what I have:
Get the Tracking_Ids from the form
params[:asset].each_value do |prod|
@records = Asset.find_all_by_tracking_id(prod[:tracking_id])
end
@assets = []
for record in @records
@assets.insert(-1,{ 'record' => record})
end
# Now execute transaction and commit to db
begin
Asset.transaction(medproc) do
# save new medprocedure entry
medproc.save!
# save link in join table (professionals)
medproc.professionals << professional_record
# save updated asset record
for asset in @assets
asset['record'].medprocedure_id = medproc.id
asset['record'].state_id = 12
asset['record'].save!
end
#raise "Exeception"
end
When the form submits, Im trying to save a foreign key (medprocedure_id)
in the asset table for each of the tracking_id’s in the form. Almost
have it working, however, its not saving the foreign key for all the
records. Only for the last one.
In your original post you implied that you replicated the view line