def render(thing = nil, opts = {})
opts, thing = thing, nil if thing.is_a?(Hash)
opts = self.class.default_render_options.merge(opts)
thing ||= action_name.to_sym
opts[:format] ? (self.content_type = opts[:format]) : content_type
_handle_options!(opts)
if thing.is_a?(Symbol) || opts[:template]
template_method, template_location = _template_for(thing, content_type, controller_name, opts)
raise TemplateNotFound, "No template found at #{template_location}.*" \
unless template_method && self.respond_to?(template_method)
throw_content(:for_layout, self.send(template_method))
elsif thing.is_a?(String)
throw_content(:for_layout, thing)
end
layout = opts[:layout] != false && _get_layout(opts[:layout])
layout ? send(layout) : catch_content(:for_layout)
end