Module: Rango::StackRendering
- Includes:
- RenderMixin
- Defined in:
- lib/rango/mixins/rendering.rb
Instance Method Summary collapse
- #display(object) ⇒ Object
- #render(context = Hash.new) ⇒ Object
- #template_basename ⇒ Object
- #template_dirname ⇒ Object
-
#template_path ⇒ Object
def template_basename case request when “show” self.class.name.singularize when “index” else end end.
Instance Method Details
#display(object) ⇒ Object
52 53 54 55 56 57 |
# File 'lib/rango/mixins/rendering.rb', line 52 def display(object) render rescue TemplateNotFound callback = self.formats[request.action] callback.call end |
#render(context = Hash.new) ⇒ Object
48 49 50 |
# File 'lib/rango/mixins/rendering.rb', line 48 def render(context = Hash.new) super(self.template_path, self.scope, self.context.merge!(context)) end |
#template_basename ⇒ Object
31 32 33 |
# File 'lib/rango/mixins/rendering.rb', line 31 def template_basename request["router.action"] end |
#template_dirname ⇒ Object
27 28 29 |
# File 'lib/rango/mixins/rendering.rb', line 27 def template_dirname self.class.name.gsub("::", "/").camel_case end |
#template_path ⇒ Object
def template_basename
case request["router.action"]
when "show"
self.class.name.singularize
when "index"
else
end
end
44 45 46 |
# File 'lib/rango/mixins/rendering.rb', line 44 def template_path File.join(template_dirname, template_basename) end |