From 6abbc4a5884a109052fe46d886895ec476766519 Mon Sep 17 00:00:00 2001 From: Aaron Patterson Date: Tue, 7 May 2013 16:19:31 -0700 Subject: if the callbacks are not the same class, they cannot be duplicates --- activesupport/lib/active_support/callbacks.rb | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'activesupport/lib') 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 -- cgit v1.2.3