Reputation: 25378
In my controller I have:
render :layout => 'mobile'
In my view I want to be able to get the name of the layout, in this case "mobile".
I don't need the controller or action name...just the name of the layout.
I'm using Rails 3.0.6.
Upvotes: 5
Views: 5177
Reputation: 3470
I was late, but try this:
controller.send(:_layout).virtual_path.name
Tested in Rails 3.2
Upvotes: 11
Reputation: 8503
why you dont make an variable in your controller:
@layout = 'mobile'
render :layout => @layout
then you can access @layout
in your view
Upvotes: 0