Sha256: 71366bbee7fac743083cb867843cac10928f336a8656bffa885e699e933761e9

Contents?: true

Size: 906 Bytes

Versions: 3

Compression:

Stored size: 906 Bytes

Contents

# For Rails 2.3.x we need to monkey patch action controller to alter the exception templates

module ActionController
  class Base
    silence_warnings do
      ActionController::Base::RESCUES_TEMPLATE_PATH = File.join(File.dirname(__FILE__), 'templates')
    end
    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
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
code_buddy-0.1.2 lib/code_buddy/rails2/monkey_patch_action_controller.rb
code_buddy-0.1.1 lib/code_buddy/rails2/monkey_patch_action_controller.rb
code_buddy-0.1.0 lib/code_buddy/rails2/monkey_patch_action_controller.rb