Skip to content
This repository has been archived by the owner on Feb 7, 2020. It is now read-only.

Template Contexts

Tass edited this page Sep 13, 2010 · 7 revisions

Default context for template rendering is context of default controller object.

Or if you want to, you can specify object explicitly

  • helpers
  • request object etc

There are three different render methods:

  • render mixin: render(path, context = Object.new, locals = Hash.new)
  • explicit rendering: render(template, locals = Hash.new)
  • implicit rendering: render(template)
    see rango/mixins/render.rb and rango/mixins/rendering.rb for reference
    The point is explicit rendering has locals method returning a hash which is passed to render from render mixin
    @locals ||= {request: self.request}
    So you include ExplicitRendering to use
    / render into layout or render just content block if request is AJAX - extends "base.html" unless request.ajax?
Clone this wiki locally