Render the provided template with the given local assigns. If the template has not been rendered with the provided local assigns yet, or if the template has been updated on disk, then the template will be compiled to a method.
Either, but not both, of template and file_path may be nil. If file_path is given, the template will only be read if it has to be compiled.
Source Code
# File action_view/base.rb, line 624 def compile_and_render_template(handler, template = nil, file_path = nil, local_assigns = {}) #:nodoc: # convert string keys to symbols if requested local_assigns = local_assigns.symbolize_keys if @@local_assigns_support_string_keys # compile the given template, if necessary if compile_template?(template, file_path, local_assigns) template ||= read_template_file(file_path, nil) compile_template(handler, template, file_path, local_assigns) end # Get the method name for this template and run it method_name = @@method_names[file_path || template] evaluate_assigns send(method_name, local_assigns) do |*name| instance_variable_get "@content_for_#{name.first || 'layout'}" end end
<code/>and<pre/>for code samples.