How to call views from multiple controllers?
I have multiple controllers having their own views (Index.html). Now, I want to create another controller (Say "Welcome") and I want to include views of all other controllers into the view of "Welcome", so that all the views are available on single page and welcome page gets updated automatically whenever I change any in开发者_运维知识库dividual index page of any controller.
If you whant to have view of one controller inside other controllers view you should render first view as a file <%=render 'controller/action'%>
and in such case you must assign all variables that are neccessary for building this view(all variables that are assigned inside action) But you'll render this view inside your controllers layout and if you have some filters you also must apply them to the new controller
精彩评论