views:

204

answers:

1

I have the answer for the Rails 2.X but not for Rails 3. How can I read the name of a current layout rendered inside a view.

My Rails2 question: http://stackoverflow.com/questions/2622219/rails-layout-name-inside-view

Thx.

+1  A: 

I think it should be in core, but for now you can make a helper method:

 def current_layout
    controller.send :_layout
  end

it will return currently used layout name

Tomasz Mazur
This is true in case you do not manually render a layout like this: render :layout => 'application'.
xpepermint