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.
I was late, but try this:
controller.send(:_layout).virtual_path.name
Tested in Rails 3.2
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With