How can I print out the name of current layout in a view?
Example
puts controller.current_layout
Thx
This works with Rails 3.0.7:
controller.send :_layout
Obviously, it's a private method, so use at your own risk.
This works for me: response.layout
UPDATE: True, response.layout does not work in rails3+ thus I usually define a @layout_name variable inside each layout.
Example of application.html.haml
- @layout_name = 'application'
!!! Strict
%html
...
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