Module: ActionController::Rendering

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

Constant Summary

Constants included from AbstractController::Rendering

AbstractController::Rendering::DEFAULT_PROTECTED_INSTANCE_VARIABLES

Instance Method Summary collapse

Methods included from AbstractController::Rendering

#_render_template, #process, #view_assigns, #view_context, #view_context_class, #view_renderer

Methods included from AbstractController::ViewPaths

#_prefixes, #append_view_path, #details_for_lookup, #lookup_context, #prepend_view_path

Instance Method Details

#process_actionObject

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



8
9
10
11
# File '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
18
19
# File 'lib/action_controller/metal/rendering.rb', line 14

def render(*args) #:nodoc:
  raise ::AbstractController::DoubleRenderError if response_body
  super
  self.content_type ||= Mime[lookup_context.rendered_format].to_s
  response_body
end

#render_to_bodyObject



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

def render_to_body(*)
  super || " "
end

#render_to_stringObject

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



22
23
24
25
26
27
28
29
30
# File 'lib/action_controller/metal/rendering.rb', line 22

def render_to_string(*)
  if self.response_body = super
    string = ""
    response_body.each { |r| string << r }
    string
  end
ensure
  self.response_body = nil
end