diff options
| author | Aaron Patterson <aaron.patterson@gmail.com> | 2013-05-10 11:05:47 -0700 | 
|---|---|---|
| committer | Aaron Patterson <aaron.patterson@gmail.com> | 2013-05-10 11:05:47 -0700 | 
| commit | d1316bb128b1905995ba9f3e4ff35a628b845780 (patch) | |
| tree | f7212384b49182759387d76d35e772ccfe46bb42 | |
| parent | ade7d365e434b586a4c1747d917beb986cb35fc7 (diff) | |
| download | rails-d1316bb128b1905995ba9f3e4ff35a628b845780.tar.gz rails-d1316bb128b1905995ba9f3e4ff35a628b845780.tar.bz2 rails-d1316bb128b1905995ba9f3e4ff35a628b845780.zip | |
just run compiled callbacks since they are cached
| -rw-r--r-- | activesupport/lib/active_support/callbacks.rb | 18 | 
1 files changed, 4 insertions, 14 deletions
| diff --git a/activesupport/lib/active_support/callbacks.rb b/activesupport/lib/active_support/callbacks.rb index 32234431a6..4b5c1ed538 100644 --- a/activesupport/lib/active_support/callbacks.rb +++ b/activesupport/lib/active_support/callbacks.rb @@ -76,8 +76,9 @@ module ActiveSupport      #     save      #   end      def run_callbacks(kind, &block) -      runner_name = self.class.__define_callbacks(kind, self) -      send(runner_name, &block) +      runner = self.class.__define_callbacks(kind, self) +      e = Filters::Environment.new(self, false, nil, block) +      runner.call(e).value      end      private @@ -430,18 +431,7 @@ module ActiveSupport        # if it was not yet defined.        # This generated method plays caching role.        def __define_callbacks(kind, object) #:nodoc: -        name = __callback_runner_name(kind) -        unless object.respond_to?(name, true) -          filter_chain = object.send("_#{kind}_callbacks").compile -          class_eval do -            define_method(name) do |&block| -              e = Filters::Environment.new(self, false, nil, block) -              filter_chain.call(e).value -            end -            protected name -          end -        end -        name +        object.send("_#{kind}_callbacks").compile        end        def __reset_runner(symbol) | 
