Class: Edifice::TemplateRenderer

Inherits:
ActionView::TemplateRenderer
  • Object
show all
Defined in:
lib/edifice/renderer.rb

Instance Method Summary collapse

Instance Method Details

#render_template(template, layout_name = nil, locals = {}) ⇒ Object



13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/edifice/renderer.rb', line 13

def render_template(template, layout_name = nil, locals = {})
  layout_name = layout_name.call if layout_name.is_a? Proc
  layout = if layout_name.is_a? String then layout_name.split('/').last else '' end
  
  # ensure we aren't rendering e.g. text
  if template.respond_to?(:virtual_path) and @view.controller and @view.controller.respond_to?(:set_edifice_names)
    @view.controller.set_edifice_names(template.virtual_path.name, 
      template.virtual_path.prefix, layout)
  end
  
  super(template, layout_name, locals)
end