Renders the template which is given as a string as either erb or builder depending on template_extension. The hash in local_assigns is made available as local variables.
Source Code
# File action_view/base.rb, line 362 def render_template(template_extension, template, file_path = nil, local_assigns = {}) #:nodoc: handler = self.class.handler_for_extension(template_extension) if template_handler_is_compilable?(handler) compile_and_render_template(handler, template, file_path, local_assigns) else template ||= read_template_file(file_path, template_extension) # Make sure that a lazyily-read template is loaded. delegate_render(handler, template, local_assigns) end end
<code/>and<pre/>for code samples.