Module: ActionController::Rendering

Extended by:
ActiveSupport::Concern
Included in:
DataStreaming
Defined in:
actionpack/lib/action_controller/metal/rendering.rb

Constant Summary collapse

RENDER_FORMATS_IN_PRIORITY =
[:body, :text, :plain, :html]

Instance Method Summary collapse

Methods included from ActiveSupport::Concern

append_features, extended, included

Instance Method Details

#process_actionObject

Before processing, set the request formats in current controller formats.



8
9
10
11
# File 'actionpack/lib/action_controller/metal/rendering.rb', line 8

def process_action(*) #:nodoc:
  self.formats = request.formats.map(&:ref).compact
  super
end

#render(*args) ⇒ Object

Check for double render errors and set the content_type after rendering.



14
15
16
17
# File 'actionpack/lib/action_controller/metal/rendering.rb', line 14

def render(*args) #:nodoc:
  raise ::AbstractController::DoubleRenderError if self.response_body
  super
end

#render_to_body(options = {}) ⇒ Object



31
32
33
# File 'actionpack/lib/action_controller/metal/rendering.rb', line 31

def render_to_body(options = {})
  super || _render_in_priorities(options) || ' '
end

#render_to_stringObject

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



20
21
22
23
24
25
26
27
28
29
# File 'actionpack/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