What would be the best way to split a user profile model and its form into several sub forms that you can update separately?
like
* basic details
- details details
- my photos
- my interests
You can only have 1 edit action, so what would be the preferred way of handling this?
So in reality, what you really probably want to do is create a set of nested resources for the user, so that you can treat each of these separately.
Which gives you routes like:
edit_user_basic_details(@user), so then, you can have forms that hit the update actions of these sub resources, like this:This way, you can setup controllers like this:
This is a very quick and dirty way to implement this, but its meant to show you have to get started. You don’t have to think about form and controllers as only editing tables in your database, sometimes its much more convenient to think about particular parts of one of your models as its own resource which can be edit separately.
Hope this gets you started.