Method: ActionController::Rendering#render_to_string

Defined in:
lib/action_controller/metal/rendering.rb

#render_to_stringObject

Similar to #render, but only returns the rendered template as a string, instead of setting ‘self.response_body`. – Override render_to_string because body can now be set to a Rack body.



174
175
176
177
178
179
180
181
182
183
# File 'lib/action_controller/metal/rendering.rb', line 174

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