Permalink
Browse files

decouple define_callback from the instance

  • Loading branch information...
1 parent 8fd422e commit c2b337183814cbd028407830509ce1da52e0e031 @tenderlove tenderlove committed Oct 2, 2013
Showing with 4 additions and 2 deletions.
  1. +4 −2 activerecord/lib/active_record/associations/builder/collection_association.rb
@@ -25,7 +25,9 @@ def initialize(name, scope, options)
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 @@ def define_extensions(model)
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

0 comments on commit c2b3371

Please sign in to comment.