Friday, 23 August 2013

Passing an array of objects from view to controller

Passing an array of objects from view to controller

I want to pass an array of objects to controller. Namely, in
preview.html.erb, I have an array @imported companies which have no ids
yet (not saved yet). I want to pass it to call save_imported method in
company_imports_controller.rb. In the save_imported method, I will save
all the objects in @imported companies. Since the objects do not have ID
yet so I can not pass the IDs via params.

No comments:

Post a Comment