# Updating multiple records at once with update action

**URL:** <https://www.ruby-forum.com/t/updating-multiple-records-at-once-with-update-action/150010>\
**Category:** Rails\
**Created:** [October 2, 2008, 11:18am UTC](https://www.ruby-forum.com/t/updating-multiple-records-at-once-with-update-action/150010 "2008-10-02T11:18:12Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![davidtl](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/35a633/32.png) [@davidtl](https://www.ruby-forum.com/u/davidtl)\
**Post date:** [October 2, 2008, 11:18am UTC](https://www.ruby-forum.com/t/updating-multiple-records-at-once-with-update-action/150010/1 "2008-10-02T11:18:12Z")

</div>

I have a model called Setting, and I want to be able to edit and update  
multiple settings at once. Therefore I added this resource to routes.rb:

map.resources :settings, :collection =\> {:edit =\> :get, :update =\> :put}

As you can see I want to edit and update _collections_ of settings, not  
just a single Setting at a time.

When I run “rake routes” I get the following routes as expected:

…  
update\_settings PUT /settings/update {:controller=\>“settings”,  
:action=\>“upda  
te”, :id=\>/[^/.?]+/}  
…  
edit\_settings GET /settings/edit {:controller=\>“settings”,  
:action=\>“edit”, :id=\>/[^/.?]+/}  
…

But as you can see, both the edit and update actions still require me to  
set an id! But since I’m updating multiple settings, that’s not  
possible.

This (I’m using HAML):

- form\_tag update\_settings\_path, :method =\> “put” do

generates this error:

update\_settings\_url failed to generate from {:action=\>“update”,  
:controller=\>“settings”}, expected: {:id=\>/[^/.?]+/, :action=\>“update”,  
:controller=\>“settings”}, diff: {:id=\>/[^/.?]+/}

How can I solve this? I am not so much into regular expressions, but  
it’s just requiring a number, right?

If none of you have a suggestion, I’ll post a ticket to Rails’  
lighthouse.
