From 49a0f554a66ed427df2ab9942e64252b56b60c27 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafael=20Mendon=C3=A7a=20Fran=C3=A7a?= Date: Thu, 4 Apr 2013 18:19:55 -0300 Subject: Revert "Merge pull request #10034 from benofsky/fix_skipping_object_callback_filters" This reverts commit c79c6980647eb76bfa52178711fb04ba7e9d403b, reversing changes made to ba4c27479add60b783a0e623c8a5d176c1dc9043. This broke all the tests. See https://travis-ci.org/rails/rails/builds/6061839 --- activesupport/lib/active_support/callbacks.rb | 14 +------------- 1 file changed, 1 insertion(+), 13 deletions(-) (limited to 'activesupport/lib/active_support') diff --git a/activesupport/lib/active_support/callbacks.rb b/activesupport/lib/active_support/callbacks.rb index 4a3636eb56..6c0cae71ed 100644 --- a/activesupport/lib/active_support/callbacks.rb +++ b/activesupport/lib/active_support/callbacks.rb @@ -131,7 +131,6 @@ module ActiveSupport end def matches?(_kind, _filter) - _filter = _method_name_for_object_filter(_kind, _filter) if @_is_object_filter @kind == _kind && @filter == _filter end @@ -235,14 +234,6 @@ module ActiveSupport @compiled_options = conditions.flatten.join(" && ") end - def _method_name_for_object_filter(kind, filter) - class_name = filter.kind_of?(Class) ? filter.to_s : filter.class.to_s - class_name.gsub!(/<|>|#/, '') - class_name.gsub!(/\/|:/, "_") - - "_callback_#{kind}_#{class_name}" - end - # Filters support: # # Arrays:: Used in conditions. This is used to specify @@ -264,8 +255,6 @@ module ActiveSupport # a method is created that calls the before_foo method # on the object. def _compile_filter(filter) - @_is_object_filter = false - case filter when Array filter.map {|f| _compile_filter(f)} @@ -280,8 +269,7 @@ module ActiveSupport method_name << (filter.arity == 1 ? "(self)" : " self, Proc.new ") else - method_name = _method_name_for_object_filter(kind, filter) - @_is_object_filter = true + method_name = "_callback_#{@kind}_#{next_id}" @klass.send(:define_method, "#{method_name}_object") { filter } _normalize_legacy_filter(kind, filter) -- cgit v1.2.3