# Routing convention for updating multiple resources

**URL:** <https://www.ruby-forum.com/t/routing-convention-for-updating-multiple-resources/165444>\
**Category:** Rails\
**Created:** [April 14, 2009, 12:54am UTC](https://www.ruby-forum.com/t/routing-convention-for-updating-multiple-resources/165444 "2009-04-14T00:54:37Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![dukael](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/c77e96/32.png) [@dukael](https://www.ruby-forum.com/u/dukael)\
**Post date:** [April 14, 2009, 12:54am UTC](https://www.ruby-forum.com/t/routing-convention-for-updating-multiple-resources/165444/1 "2009-04-14T00:54:37Z")

</div>

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
