Module: ActionController::Rendering

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

Defined Under Namespace

Modules: ClassMethods

Constant Summary collapse

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

Instance Method Summary collapse

Methods included from ActiveSupport::Concern

append_features, class_methods, extended, included, prepend_features, prepended

Instance Method Details

#render(*args) ⇒ Object

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


28
29
30
31
# File 'actionpack/lib/action_controller/metal/rendering.rb', line 28

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

#render_to_body(options = {}) ⇒ Object


45
46
47
# File 'actionpack/lib/action_controller/metal/rendering.rb', line 45

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

#render_to_stringObject

Override render_to_string because body can now be set to a Rack body.


34
35
36
37
38
39
40
41
42
43
# File 'actionpack/lib/action_controller/metal/rendering.rb', line 34

def render_to_string(*)
  result = super
  if result.respond_to?(:each)
    string = +""
    result.each { |r| string << r }
    string
  else
    result
  end
end