Forum: Ruby on Rails Adding "update all" functionality

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.
Scott C. (Guest)
on 2007-07-30 19: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?


This topic is locked and can not be replied to.