module ActionController::Rendering - actionpack-4.2.3 Documentation

# module ActionController::Rendering

### Constants

RENDER_FORMATS_IN_PRIORITY

### Public Instance Methods

render_to_body(options = {}) click to toggle source
Calls superclass method

    # File lib/action_controller/metal/rendering.rb, line 31
    def render_to_body(options = {})
      super || _render_in_priorities(options) || ' '
    end

render_to_string(*) click to toggle source

Overwrite #render_to_string because body can now be set to a rack body.

Calls superclass method

    # File lib/action_controller/metal/rendering.rb, line 20
    def render_to_string(*)
      result = super
      if result.respond_to?(:each)
        string = ""
        result.each { |r| string << r }
        string
      else
        result
      end
    end

### Private Instance Methods

_normalize_text(options) click to toggle source

    # File lib/action_controller/metal/rendering.rb, line 81
    def _normalize_text(options)
      RENDER_FORMATS_IN_PRIORITY.each do |format|
        if options.key?(format) && options[format].respond_to?(:to_text)
          options[format] = options[format].to_text
        end
      end
    end

_process_format(format, options = {}) click to toggle source
Calls superclass method

    # File lib/action_controller/metal/rendering.rb, line 45
    def _process_format(format, options = {})
      super

      if options[:plain]
        self.content_type = Mime::TEXT
      else
        self.content_type ||= format.to_s
      end
    end

_render_in_priorities(options) click to toggle source

    # File lib/action_controller/metal/rendering.rb, line 37
    def _render_in_priorities(options)
      RENDER_FORMATS_IN_PRIORITY.each do |format|
        return options[format] if options.key?(format)
      end

      nil
    end