It's in my understanding that I can specify a layout for a controller by putting
layout 'mylayout'
in the controller file. I further understand that I can specify certain actions that the layout will be invoked for with :only
and :except
as such:
layout 'mylayout', :only => [:index, :new]
or
layout 'mylayout', :except => [:index, :new]
What I am wondering is, can I put layout 'mylayout'
in my application controller and specify that to be rendered for only certain controllers with something like :only_controller
and :except_controller
, or do I have to specify layout 'mylayout'
in every controller I want it to be rendered in?
The reason for this is that I have a few controllers that are in charge of the admin section of my site, and I'd like to have a different layout for them.