Routing convention for updating multiple resources

Hi,

In my Rails apps I often have user interfaces that allow editing and
updating of multiple records. I was wondering how developers generally
implement this in terms of resources.

I tend to do:
map.resources :products do |prod|
prod.resources :suppliers, :controller => ‘product/suppliers’,
:collection => {:edit_all => :get, :update_all => :put}
end

And use “update_all_product_suppliers_path(@product)” for my form
path.

A simpler alternative would be to change ‘prod.resources’ to
‘prod.resource’ but that would make changes to individual
‘suppliers’ (e.g. via web service) harder and seems against the spirit
of RESTful design.

Creating/updating multiple records must be a common idiom, especially
with the new nested attributes work, so how do you do it?

Thanks,
Andrew

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs