Method: ActionView::StreamingTemplateRenderer#render_template
- Defined in:
- actionview/lib/action_view/renderer/streaming_template_renderer.rb
#render_template(view, template, layout_name = nil, locals = {}) ⇒ Object
For streaming, instead of rendering a given a template, we return a Body object that responds to each. This object is initialized with a block that knows how to render the template.
45 46 47 48 49 50 51 52 53 54 |
# File 'actionview/lib/action_view/renderer/streaming_template_renderer.rb', line 45 def render_template(view, template, layout_name = nil, locals = {}) # :nodoc: return [super.body] unless layout_name && template.supports_streaming? locals ||= {} layout = find_layout(layout_name, locals.keys, [formats.first]) Body.new do |buffer| delayed_render(buffer, template, layout, view, locals) end end |