public Method

Base.render_file(template_path, use_full_path = true, local_assigns = {})

Renders the template present at template_path. If use_full_path is set to true, it’s relative to the view_paths array, otherwise it’s absolute. The hash in local_assigns is made available as local variables.

Source Code

# File action_view/base.rb, line 265
def render_file(template_path, use_full_path = true, local_assigns = {}) #:nodoc:
  if defined?(ActionMailer) && defined?(ActionMailer::Base) && controller.is_a?(ActionMailer::Base) && !template_path.include?("/")
    raise ActionViewError, "Due to changes in ActionMailer, you need to provide the mailer_name along with the template name.\n\nrender \"user_mailer/signup\"\nrender :file => \"user_mailer/signup\"\n\nIf you are rendering a subtemplate, you must now use controller-like partial syntax:\n\nrender :partial => 'signup' # no mailer_name necessary\n"
  end

  template = Template.new(self, template_path, use_full_path, local_assigns)

  begin
    render_template(template)
  rescue Exception => e
    if TemplateError === e
      e.sub_template_of(template.filename)
      raise e
    else
      raise TemplateError.new(template, @assigns, e)
    end
  end
end
Comments

Have your say
Please use Textile formatting (click here for a cheat sheet). Use <code/> and <pre/> for code samples.
Click here to login with OpenID to to post comments.