Skip to content
Browse files

if the callbacks are not the same class, they cannot be duplicates

  • Loading branch information...
1 parent f21da67 commit 6abbc4a5884a109052fe46d886895ec476766519 @tenderlove tenderlove committed
Showing with 6 additions and 2 deletions.
  1. +6 −2 activesupport/lib/active_support/callbacks.rb
View
8 activesupport/lib/active_support/callbacks.rb
@@ -99,10 +99,12 @@ def matches?(_kind, _filter)
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 @@ def matches?(_kind, _filter)
end
def duplicates?(other)
+ return false unless self.class == other.class
+
matches?(other.kind, other.filter)
end

0 comments on commit 6abbc4a

Please sign in to comment.
Something went wrong with that request. Please try again.