1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

AS::Callbacks: fix run_callbacks for objects with negative id

This commit is contained in:
Bogdan Gusiev 2012-05-18 09:50:09 +03:00
parent a6a8957132
commit 911a0859ac

View file

@ -329,7 +329,7 @@ module ActiveSupport
# This generated method plays caching role. # This generated method plays caching role.
def __define_callbacks(kind, object) #:nodoc: def __define_callbacks(kind, object) #:nodoc:
chain = object.send("_#{kind}_callbacks") chain = object.send("_#{kind}_callbacks")
name = "_run_callbacks_#{chain.object_id}" name = "_run_callbacks_#{chain.object_id.abs}"
unless object.respond_to?(name, true) unless object.respond_to?(name, true)
class_eval <<-RUBY_EVAL, __FILE__, __LINE__ + 1 class_eval <<-RUBY_EVAL, __FILE__, __LINE__ + 1
def #{name}() #{chain.compile} end def #{name}() #{chain.compile} end