Skip to content
This repository was archived by the owner on Nov 9, 2017. It is now read-only.

Uninitialized constant when used with Rails 3 #9

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions lib/exception_notifier.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,21 +4,21 @@
class ExceptionNotifier
def self.default_ignore_exceptions
[].tap do |exceptions|
exceptions << ActiveRecord::RecordNotFound if defined? ActiveRecord
exceptions << AbstractController::ActionNotFound if defined? AbstractController
exceptions << ActionController::RoutingError if defined? ActionController
exceptions << ::ActiveRecord::RecordNotFound if defined?(::ActiveRecord::RecordNotFound)
exceptions << ::AbstractController::ActionNotFound if defined?(::AbstractController::ActionNotFound)
exceptions << ::ActionController::RoutingError if defined?(::ActionController::RoutingError)
end
end

def initialize(app, options = {})
@app, @options = app, options
@options[:ignore_exceptions] ||= self.class.default_ignore_exceptions
end

def call(env)
@app.call(env)
rescue Exception => exception
options = (env['exception_notifier.options'] ||= {})
@options[:ignore_exceptions] ||= self.class.default_ignore_exceptions
options.reverse_merge!(@options)

unless Array.wrap(options[:ignore_exceptions]).include?(exception.class)
Expand Down