From bb1492e334e2d2efccb9d3c111648b895f626633 Mon Sep 17 00:00:00 2001 From: Aaron Patterson Date: Mon, 22 Jul 2013 17:59:42 -0700 Subject: decouple extensions from association object state --- activerecord/lib/active_record/associations/builder/association.rb | 4 ++-- activerecord/lib/active_record/autosave_association.rb | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) (limited to 'activerecord/lib/active_record') diff --git a/activerecord/lib/active_record/associations/builder/association.rb b/activerecord/lib/active_record/associations/builder/association.rb index bbc1c20f60..cd0642c592 100644 --- a/activerecord/lib/active_record/associations/builder/association.rb +++ b/activerecord/lib/active_record/associations/builder/association.rb @@ -48,14 +48,14 @@ module ActiveRecord::Associations::Builder @model.generated_feature_methods end - include Module.new { def build; end } + include Module.new { def build(*args); end } def build validate_options define_accessors configure_dependency if options[:dependent] @reflection = model.create_reflection(macro, name, scope, options, model) - super # provides an extension point + super(@model, @reflection) # provides an extension point @reflection end diff --git a/activerecord/lib/active_record/autosave_association.rb b/activerecord/lib/active_record/autosave_association.rb index c991c870ed..e06405d043 100644 --- a/activerecord/lib/active_record/autosave_association.rb +++ b/activerecord/lib/active_record/autosave_association.rb @@ -127,7 +127,7 @@ module ActiveRecord extend ActiveSupport::Concern module AssociationBuilderExtension #:nodoc: - def build + def build(model, reflection) model.send(:add_autosave_association_callbacks, reflection) super end -- cgit v1.2.3