Routing convention for updating multiple resources


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}

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

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?


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