Forum: Ruby on Rails Adding "update all" functionality

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
F56061caeb558fbb6c1d380e8383f377?d=identicon&s=25 Scott Caldwell (scaldwell)
on 2007-07-30 17:28
I have a simple model called “foo” and I’m using the scaffold generated
code. When I edit “foo” I want to be able to click a check box that says
“update all”. When the param is passed I cycle through all the “foos” in
the database and update them with the single “foo” form variables…if the
param isn’t passed then it only updates the selected “foo”.

I have a sample that works but it bypasses all the validation. Also, I
get stale object errors because the lock_version for the unselected
models isn’t getting incremented when it’s selected for edit, since it’s
never selected.

Has anyone done this before?

Thanks,

Scott
This topic is locked and can not be replied to.