Returns the name of the active layout. If the layout was specified as a
method reference (through a symbol), this method is called and the return
value is used. Likewise if the layout was specified as an inline method
(through a proc or method object). If the layout was defined without a
directory, layouts is assumed. So layout
"weblog/standard" will return weblog/standard, but
layout "standard" will return layouts/standard.
# File actionpack/lib/action_controller/layout.rb, line 218
def active_layout(passed_layout = nil)
layout = passed_layout || self.class.default_layout(default_template_format)
active_layout = case layout
when String then layout
when Symbol then __send__(layout)
when Proc then layout.call(self)
end
# Explicitly passed layout names with slashes are looked up relative to the template root,
# but auto-discovered layouts derived from a nested controller will contain a slash, though be relative
# to the 'layouts' directory so we have to check the file system to infer which case the layout name came from.
if active_layout
if active_layout.include?('/') && ! layout_directory?(active_layout)
active_layout
else
"layouts/#{active_layout}"
end
end
end