Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

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

Merged
merged 1 commit into from

3 participants

@josevalim josevalim merged commit 88949f8 into rails:master
@gmile gmile commented on the diff
activesupport/lib/active_support/callbacks.rb
@@ -329,7 +329,7 @@ module ClassMethods
# This generated method plays caching role.
def __define_callbacks(kind, object) #:nodoc:
chain = object.send("_#{kind}_callbacks")
- name = "_run_callbacks_#{chain.object_id}"
+ name = "_run_callbacks_#{chain.object_id.abs}"
@gmile
gmile added a note

object_id potentially can be negative?

@bogdan
bogdan added a note

Yes, it could.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
This page is out of date. Refresh to see the latest.
Showing with 1 addition and 1 deletion.
  1. +1 −1  activesupport/lib/active_support/callbacks.rb
View
2  activesupport/lib/active_support/callbacks.rb
@@ -329,7 +329,7 @@ module ClassMethods
# This generated method plays caching role.
def __define_callbacks(kind, object) #:nodoc:
chain = object.send("_#{kind}_callbacks")
- name = "_run_callbacks_#{chain.object_id}"
+ name = "_run_callbacks_#{chain.object_id.abs}"
@gmile
gmile added a note

object_id potentially can be negative?

@bogdan
bogdan added a note

Yes, it could.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
unless object.respond_to?(name, true)
class_eval <<-RUBY_EVAL, __FILE__, __LINE__ + 1
def #{name}() #{chain.compile} end
Something went wrong with that request. Please try again.