Adding "update all" functionality

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