diff options
-rw-r--r-- | activerecord/lib/active_record/associations/builder/collection_association.rb | 8 |
1 files changed, 6 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 22e8479b71..bdfd65cd33 100644 --- a/activerecord/lib/active_record/associations/builder/collection_association.rb +++ b/activerecord/lib/active_record/associations/builder/collection_association.rb @@ -22,10 +22,14 @@ module ActiveRecord::Associations::Builder def build wrap_block_extension reflection = super - CALLBACKS.each { |callback_name| define_callback(callback_name) } reflection end + def define_callbacks(model, reflection) + super + CALLBACKS.each { |callback_name| define_callback(model, callback_name) } + end + def writable? true end @@ -51,7 +55,7 @@ module ActiveRecord::Associations::Builder @extension_module_name ||= "#{model.name.demodulize}#{name.to_s.camelize}AssociationExtension" end - def define_callback(callback_name) + def define_callback(model, callback_name) full_callback_name = "#{callback_name}_for_#{name}" # TODO : why do i need method_defined? I think its because of the inheritance chain |