diff --git a/activesupport/lib/active_support/callbacks.rb b/activesupport/lib/active_support/callbacks.rb index faa24d09de4d4..db86a532ff32b 100644 --- a/activesupport/lib/active_support/callbacks.rb +++ b/activesupport/lib/active_support/callbacks.rb @@ -94,20 +94,8 @@ module Filters 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 @@ def matches?(_kind, _filter) 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)