Module: Bugsnag::Rails::ActionControllerRescue::ClassMethods

Defined in:
lib/bugsnag/rails/action_controller_rescue.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.extended(base) ⇒ Object



38
39
40
41
42
# File 'lib/bugsnag/rails/action_controller_rescue.rb', line 38

def self.extended(base)
  base.singleton_class.class_eval do
    alias_method_chain :filter_parameter_logging, :bugsnag
  end
end

Instance Method Details

#filter_parameter_logging_with_bugsnag(*filter_words, &block) ⇒ Object

Rails 2 does parameter filtering via a controller configuration method that dynamically defines a method on the controller, so the configured parameters aren’t easily accessible. Intercept these parameters as they’re configured so that the Bugsnag configuration can take them into account.



50
51
52
53
54
55
56
57
58
# File 'lib/bugsnag/rails/action_controller_rescue.rb', line 50

def filter_parameter_logging_with_bugsnag(*filter_words, &block)
  if filter_words.length > 0
    Bugsnag.configure do |config|
      # Use the same regular expression that Rails parameter filtering uses.
      config.params_filters << Regexp.new(filter_words.collect{ |s| s.to_s }.join('|'), true)
    end
  end
  filter_parameter_logging_without_bugsnag(*filter_words, &block)
end