diff options
Diffstat (limited to 'activesupport/lib')
-rw-r--r-- | activesupport/lib/active_support/callbacks.rb | 23 |
1 files changed, 7 insertions, 16 deletions
diff --git a/activesupport/lib/active_support/callbacks.rb b/activesupport/lib/active_support/callbacks.rb index faa24d09de..db86a532ff 100644 --- a/activesupport/lib/active_support/callbacks.rb +++ b/activesupport/lib/active_support/callbacks.rb @@ -94,20 +94,8 @@ module ActiveSupport end class Callback #:nodoc:# - class Unduplicable < Callback # :nodoc: - def duplicates?(other) - false - end - end - def self.build(chain, filter, kind, options, _klass) - klass = case filter - when Symbol, String - Callback - else - Callback::Unduplicable - end - klass.new chain, filter, kind, options, _klass + new chain, filter, kind, options, _klass end attr_accessor :chain, :kind, :options, :klass, :raw_filter @@ -155,9 +143,12 @@ module ActiveSupport end def duplicates?(other) - return false unless self.class == other.class - - matches?(other.kind, other.filter) + case @raw_filter + when Symbol, String + matches?(other.kind, other.filter) + else + false + end end def _update_filter(filter_options, new_options) |