Consolidate multiple views into one view without coupling?
Let's say I have:
object A, B, C each with corresponding models, views, and controllers
How would you load them all into one view (site index)? You could use a partial of each model's index, but then methods of that particular controller don't get called so you would have to add 开发者_Python百科that view's methods. Any other suggestions? Thanks!
What you've described is about all you can do.
However, methods of each model are still accessible no matter where you access that model from. Unless you're talking about helper methods. In which case you'll need add helper :a, :b, :c
to the site index controller, so that the helper methods associated with each model are available from views and partials rendered by the site index controller.
精彩评论