render (ActionController::Base)

    # File lib/action_controller/base.rb, line 837
          def render(options = nil, extra_options = {}, &block) #:doc:
            raise DoubleRenderError, "Can only render or redirect once per action" if performed?

            if options.nil?
              return render_for_file(default_template_name, nil, true)
            elsif !extra_options.is_a?(Hash)
              raise RenderError, "You called render with invalid options : #{options.inspect}, #{extra_options.inspect}"
            else
              if options == :update
                options = extra_options.merge({ :update => true })
              elsif !options.is_a?(Hash)
                raise RenderError, "You called render with invalid options : #{options.inspect}"
              end
            end

            if content_type = options[:content_type]
              response.content_type = content_type.to_s
            end

            if location = options[:location]
              response.headers["Location"] = url_for(location)
            end

            if options.has_key?(:text)
              render_for_text(options[:text], options[:status])

            else
              if file = options[:file]
                render_for_file(file, options[:status], options[:use_full_path], options[:locals] || {})

              elsif template = options[:template]
                render_for_file(template, options[:status], true)

              elsif inline = options[:inline]
                add_variables_to_assigns
                tmpl = ActionView::InlineTemplate.new(@template, options[:inline], options[:locals], options[:type])
                render_for_text(@template.render_template(tmpl), options[:status])

              elsif action_name = options[:action]
                template = default_template_name(action_name.to_s)
                if options[:layout] && !template_exempt_from_layout?(template)
                  render_with_a_layout(:file => template, :status => options[:status], :use_full_path => true, :layout => true)
                else
                  render_with_no_layout(:file => template, :status => options[:status], :use_full_path => true)
                end

              elsif xml = options[:xml]
                response.content_type ||= Mime::XML
                render_for_text(xml.respond_to?(:to_xml) ? xml.to_xml : xml, options[:status])

              elsif json = options[:json]
                json = json.to_json unless json.is_a?(String)
                json = "#{options[:callback]}(#{json})" unless options[:callback].blank?
                response.content_type ||= Mime::JSON
                render_for_text(json, options[:status])

              elsif partial = options[:partial]
                partial = default_template_name if partial == true
                add_variables_to_assigns

                if collection = options[:collection]
                  render_for_text(
                    @template.send!(:render_partial_collection, partial, collection,
                    options[:spacer_template], options[:locals]), options[:status]
                  )
                else
                  render_for_text(
                    @template.send!(: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)
                response.content_type = Mime::JS
                render_for_text(generator.to_s, options[:status])

              elsif options[:nothing]
                # Safari doesn't pass the headers of the return if the response is zero length
                render_for_text(" ", options[:status])

              else
                render_for_file(default_template_name, options[:status], true)
              end
            end
          end