Updating multiple records at once with update action

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.