Module: Pakada::Render::Controller

Defined in:
lib/pakada/render/controller.rb

Instance Method Summary collapse

Instance Method Details

#render(template = nil, additional_locals = {}) ⇒ Object



3
4
5
6
7
8
9
10
11
12
13
14
15
# File 'lib/pakada/render/controller.rb', line 3

def render(template = nil, additional_locals = {})
  if Hash === template
    template, additional_locals = nil, template
  end
  
  template ||= options.values_at(:module, :controller, :action).compact.join("/")

  locals = instance_variables.inject({}) {|locals, key|
    locals[key.to_sym] = instance_variable_get(key); locals
  }.merge(additional_locals)
  
  Pakada[options[:module]].render template.to_sym, locals
end