Reputation: 47086
I have a layout for posts. The postscontroller redirects to this layout . I want my blog controller to use the same layout . I do not to put the layout as my application.html.erb since all other pages uses a different layout and I have put that as my applicationlayout.
Can i do something like this in my blog controller?
render :layout => "post"
If so which view page my yield command retrieve?
Upvotes: 1
Views: 488
Reputation: 9471
Yup, render :layout => 'post'
will do it. The yield
in the layout will yield as you would expect a yield
in the application layout to.
To set a controller-wide layout, use layout 'layout_name'
at the top of your controller.
Upvotes: 5