diff options
author | Aaron Patterson <aaron.patterson@gmail.com> | 2013-10-02 14:34:51 -0700 |
---|---|---|
committer | Aaron Patterson <aaron.patterson@gmail.com> | 2013-10-02 14:34:57 -0700 |
commit | c2b337183814cbd028407830509ce1da52e0e031 (patch) | |
tree | dc4da8a1c92a2b18485d6076ee0f0a150b64ccd3 /activerecord/lib/active_record | |
parent | 8fd422edb8d377c4a7ecef21f7b80f1c6c3156fd (diff) | |
download | rails-c2b337183814cbd028407830509ce1da52e0e031.tar.gz rails-c2b337183814cbd028407830509ce1da52e0e031.tar.bz2 rails-c2b337183814cbd028407830509ce1da52e0e031.zip |
decouple define_callback from the instance
Diffstat (limited to 'activerecord/lib/active_record')
-rw-r--r-- | activerecord/lib/active_record/associations/builder/collection_association.rb | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/activerecord/lib/active_record/associations/builder/collection_association.rb b/activerecord/lib/active_record/associations/builder/collection_association.rb index 7bd0687c0b..38a70f3efd 100644 --- a/activerecord/lib/active_record/associations/builder/collection_association.rb +++ b/activerecord/lib/active_record/associations/builder/collection_association.rb @@ -25,7 +25,9 @@ module ActiveRecord::Associations::Builder def define_callbacks(model, reflection) super - CALLBACKS.each { |callback_name| define_callback(model, callback_name) } + CALLBACKS.each { |callback_name| + define_callback(model, callback_name, reflection.name, reflection.options) + } end def define_extensions(model) @@ -35,7 +37,7 @@ module ActiveRecord::Associations::Builder end end - def define_callback(model, callback_name) + def define_callback(model, callback_name, name, options) full_callback_name = "#{callback_name}_for_#{name}" # TODO : why do i need method_defined? I think its because of the inheritance chain |