I have a model in my app called Report, that has a lot of fields.
In the view we show these fields in tabbed sections, grouped by theme,
to make it easier on the user. When these were first built, the
developers at the time decided to treat these "themes" as resources and
created separate routes, controllers and views to handle them.
Lately this structure has started to bother me a lot. There are multiple
controllers performing the same actions on the same Report instance.
Moving things between the different tabs is a hassle, and adding new
tabs is a even worse.
To me the tabbed layout in the HTML represents different viewings of the
same resource. The editing and updating of that resource should be
handled in one place and not in the 4 different controllers we have
However i'm not sure how to arrange my routes and controller actions to
unify the process. I would like the URLs to looks something like
but can't find a clean way of doing that.
Another approach i've been looking at is to insert some intermediate
POROs to handle the view management. Something not unlike the presenter
This would involve significant code changes, but it might be worth it if
the final result is clean and decoupled.
Some of the tabs are - 'functional overview', 'technical overview',
Splitting up the sections into new models is not an approach i want to
I'm on Rails 2.3 but that shouldn't be important.