Module: ActionController::Rendering

Defined in:
lib/render.rb

Instance Method Summary collapse

Instance Method Details

#controller_options(*args) ⇒ Object



10
11
12
13
14
# File 'lib/render.rb', line 10

def controller_options(*args)
  options = args.first
  return options if options.is_a?(Hash) && options[:controller]
  nil
end

#render(*args) ⇒ Object



16
17
18
19
20
21
22
23
# File 'lib/render.rb', line 16

def render(*args)
  if options = controller_options(*args)
    controller = options.delete(:controller)
    render_controller(controller, options)
  else
    render_orig(*args)
  end
end

#render_controller(controller_class, options = {:action => :index}) ⇒ Object



5
6
7
8
# File 'lib/render.rb', line 5

def render_controller(controller_class, options = {:action => :index})
  status, headers, resp =  controller_class.action(options[:action]).call(request.env)
  render_orig :text => resp.body, :status => status
end

#render_origObject



4
# File 'lib/render.rb', line 4

alias_method :render_orig, :render