def render(options = nil, deprecated_status = nil, &block)
raise DoubleRenderError, "Can only render or redirect once per action" if performed?
unless options.is_a?(Hash)
if options == :update
options = {:update => true}
else
return render_file(options || default_template_name, deprecated_status, true)
end
end
if content_type = options[:content_type]
headers["Content-Type"] = content_type
end
if text = options[:text]
render_text(text, options[:status])
else
if file = options[:file]
render_file(file, options[:status], options[:use_full_path], options[:locals] || {})
elsif template = options[:template]
render_file(template, options[:status], true)
elsif inline = options[:inline]
render_template(inline, options[:status], options[:type], options[:locals] || {})
elsif action_name = options[:action]
render_action(action_name, options[:status], options[:layout])
elsif xml = options[:xml]
render_xml(xml, options[:status])
elsif partial = options[:partial]
partial = default_template_name if partial == true
if collection = options[:collection]
render_partial_collection(partial, collection, options[:spacer_template], options[:locals], options[:status])
else
render_partial(partial, ActionView::Base::ObjectWrapper.new(options[:object]), options[:locals], options[:status])
end
elsif options[:update]
add_variables_to_assigns
@template.send :evaluate_assigns
generator = ActionView::Helpers::PrototypeHelper::JavaScriptGenerator.new(@template, &block)
render_javascript(generator.to_s)
elsif options[:nothing]
render_text(" ", options[:status])
else
render_file(default_template_name, options[:status], true)
end
end
end