Forum: Ruby on Rails Routing convention for updating multiple resources

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
548dde5574b950a8ac2f09cb0ee681d5?d=identicon&s=25 Andrew France (Guest)
on 2009-04-14 00:54
(Received via mailing list)

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 topic is locked and can not be replied to.