Get the current layout's name in a view or partial

This was valid for ancient Rails versions. It won't work on current Railses.

This returns the name (including path) of your current layout:

response.layout
=> "layouts/admin" # inside views that are using the 'admin' layout

You most likely do not need the full path, so go ahead and do this:

File.basename(response.layout)
=> "admin"
Arne Hartherz