diff options
author | Aaron Patterson <aaron.patterson@gmail.com> | 2013-05-07 16:19:31 -0700 |
---|---|---|
committer | Aaron Patterson <aaron.patterson@gmail.com> | 2013-05-08 11:37:33 -0700 |
commit | 6abbc4a5884a109052fe46d886895ec476766519 (patch) | |
tree | a96e34877605259c01c1f78afaf1a62e64113218 | |
parent | f21da67aab6ad4acc2f11a1eaf800444e3b0fe21 (diff) | |
download | rails-6abbc4a5884a109052fe46d886895ec476766519.tar.gz rails-6abbc4a5884a109052fe46d886895ec476766519.tar.bz2 rails-6abbc4a5884a109052fe46d886895ec476766519.zip |
if the callbacks are not the same class, they cannot be duplicates
-rw-r--r-- | activesupport/lib/active_support/callbacks.rb | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/activesupport/lib/active_support/callbacks.rb b/activesupport/lib/active_support/callbacks.rb index 689c05ded4..0548284186 100644 --- a/activesupport/lib/active_support/callbacks.rb +++ b/activesupport/lib/active_support/callbacks.rb @@ -99,10 +99,12 @@ module ActiveSupport class Object < Callback def matches?(_kind, _filter) + return false unless super + if !_filter.is_a?(String) - super && @filter.to_s.start_with?(_method_name_for_object_filter(_kind, _filter, false)) + @filter.to_s.start_with?(_method_name_for_object_filter(_kind, _filter, false)) else - super && @filter == _filter + @filter == _filter end end end @@ -163,6 +165,8 @@ module ActiveSupport end def duplicates?(other) + return false unless self.class == other.class + matches?(other.kind, other.filter) end |