Class: ActionController::Base

Inherits:
Object
  • Object
show all
Defined in:
lib/code_buddy/rails2/monkey_patch_action_controller.rb

Instance Method Summary collapse

Instance Method Details

#rescue_action_locally(exception) ⇒ Object



8
9
10
11
12
13
14
15
16
17
# File 'lib/code_buddy/rails2/monkey_patch_action_controller.rb', line 8

def rescue_action_locally(exception)
  CodeBuddy::App.exception = exception
  code_buddy_rescue_templates_path = ActionView::Template::EagerPath.new_and_loaded(File.join(File.dirname(__FILE__), "templates"))
  @template.instance_variable_set("@exception", exception)
  @template.instance_variable_set("@rescues_path", code_buddy_rescue_templates_path)
  @template.instance_variable_set("@contents",
  @template.render(:file => template_path_for_local_rescue(exception)))
  response.content_type = Mime::HTML
  render_for_file(rescues_path("layout"), response_code_for_rescue(exception))
end