diff options
Diffstat (limited to 'activerecord')
-rw-r--r-- | activerecord/lib/active_record/associations/builder/association.rb | 4 | ||||
-rw-r--r-- | activerecord/lib/active_record/associations/builder/collection_association.rb | 10 |
2 files changed, 6 insertions, 8 deletions
diff --git a/activerecord/lib/active_record/associations/builder/association.rb b/activerecord/lib/active_record/associations/builder/association.rb index ef397fdb52..76c91ecb72 100644 --- a/activerecord/lib/active_record/associations/builder/association.rb +++ b/activerecord/lib/active_record/associations/builder/association.rb @@ -29,6 +29,7 @@ module ActiveRecord::Associations::Builder reflection = builder.build builder.define_accessors model.generated_feature_methods builder.define_callbacks model, reflection + builder.define_extensions model reflection end @@ -68,6 +69,9 @@ module ActiveRecord::Associations::Builder options.assert_valid_keys(valid_options) end + def define_extensions(model) + end + def define_callbacks(model, reflection) add_before_destroy_callbacks(model, name) if options[:dependent] Association.extensions.each do |extension| diff --git a/activerecord/lib/active_record/associations/builder/collection_association.rb b/activerecord/lib/active_record/associations/builder/collection_association.rb index 04e017a92a..fd40b320e3 100644 --- a/activerecord/lib/active_record/associations/builder/collection_association.rb +++ b/activerecord/lib/active_record/associations/builder/collection_association.rb @@ -14,8 +14,8 @@ module ActiveRecord::Associations::Builder attr_reader :block_extension - def initialize(*args) - super(*args) + def initialize(model, name, scope, options) + super @mod = nil if block_given? @mod = Module.new(&Proc.new) @@ -23,12 +23,6 @@ module ActiveRecord::Associations::Builder end end - def build - define_extensions(model) - reflection = super - reflection - end - def define_callbacks(model, reflection) super CALLBACKS.each { |callback_name| define_callback(model, callback_name) } |