I have a complex model, and want to create different screens for editing it. As a silly example, say it’s a user model, and one screen lets you edit the name, another screen edits the phone number, and another page edits the user’s preferences.
It’s easy enough to create new actions, forms for each view, routes, and so on, but the trick is when you actually hit submit, it calls update, and … then what? If there are errors, it should go back to the page being used to edit the model, not the generic ‘edit’ view. Even on success, it might be nice to go back to the page that update was called from.
Hacking something up with the session would not be difficult at all, but I always wonder “is there a better way?”.
I could not find a better way of doing it than this, and needed to do it in a hurry:
followed by