Steven Rogers
2006-Aug-14 05:31 UTC
[Rails] How to get the right form to retry for valid input
I have a situation where I have several different methods that put up
forms for the user that all update various parts of the same model.
They could all go through the same "update" method, with a structure
at the end like:
if at-variable.update_attributes(parms)
flash - it worked
else
render action => "The form that got us here"
end
however, its not obvious how to get back to the right form to re-try
for valid input. I could set a session variable or pass the form name
in a hidden field, but that seems kind of clunky. And setting up
matching Form1 - Update1, Form2 - Update2, etc. sets of methods seems
very non-DRY when the only difference between the updates is the
final render action. Is there a normal "railsy" way of setting this
up?
Thanks,
Steve
