aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/lib
diff options
context:
space:
mode:
authorAaron Patterson <aaron.patterson@gmail.com>2013-05-07 16:19:31 -0700
committerAaron Patterson <aaron.patterson@gmail.com>2013-05-08 11:37:33 -0700
commit6abbc4a5884a109052fe46d886895ec476766519 (patch)
treea96e34877605259c01c1f78afaf1a62e64113218 /activesupport/lib
parentf21da67aab6ad4acc2f11a1eaf800444e3b0fe21 (diff)
downloadrails-6abbc4a5884a109052fe46d886895ec476766519.tar.gz
rails-6abbc4a5884a109052fe46d886895ec476766519.tar.bz2
rails-6abbc4a5884a109052fe46d886895ec476766519.zip
if the callbacks are not the same class, they cannot be duplicates
Diffstat (limited to 'activesupport/lib')
-rw-r--r--activesupport/lib/active_support/callbacks.rb8
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