account controller, can I use 2 layouts within the same controller?

5 views
Skip to first unread message

S Ahmed

unread,
Mar 6, 2012, 4:17:41 PM3/6/12
to rubyonra...@googlegroups.com
My account controller is used for user registration.

And when the user signs-in, I have seperate controllers to add/update things and they all inherit from a base controller that set's the layout to a different layout and it ensures the person is signed in correctly.

Now I need to have a page where they edit their account, should I still use the account_controller which I use on the public view of the site, or should I create a different controller that inherits from that base controller for signed in users and just live with the fact that my controller is named differently than the actual model being acted upon?

Tim Shaffer

unread,
Mar 7, 2012, 12:56:35 PM3/7/12
to rubyonra...@googlegroups.com
You can specify a layout that applies only to specific actions in a controller:

layout "whatever", :only => [ :some_action ]

Check out the guide on layouts for more options: http://guides.rubyonrails.org/layouts_and_rendering.html
Reply all
Reply to author
Forward
0 new messages