def _get_layout(layout = nil)
return false if layout == false
layout = layout.instance_of?(Symbol) && self.respond_to?(layout, true) ? send(layout) : layout
layout = layout.to_s if layout
if layout
template_method, template_location =
_template_for(layout, layout.index(".") ? nil : content_type, "layout")
raise TemplateNotFound, "No layout found at #{template_location}" unless template_method
template_method
else
template, location = _template_for(controller_name, content_type, "layout")
template, location = _template_for("application", content_type, "layout") unless template
template
end
end