aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record/associations
diff options
context:
space:
mode:
authorAaron Patterson <aaron.patterson@gmail.com>2013-08-01 11:28:12 -0700
committerAaron Patterson <aaron.patterson@gmail.com>2013-08-01 11:43:52 -0700
commit86588f9bc4d6214a8e625f97fcadb246592c41c0 (patch)
treeda4a30bb4c2f04484f3612cded919c6989572bc2 /activerecord/lib/active_record/associations
parent71aba97d8d0c1b0264646c64aa3dc5661a90424c (diff)
downloadrails-86588f9bc4d6214a8e625f97fcadb246592c41c0.tar.gz
rails-86588f9bc4d6214a8e625f97fcadb246592c41c0.tar.bz2
rails-86588f9bc4d6214a8e625f97fcadb246592c41c0.zip
push more mutations outside the factory method
Diffstat (limited to 'activerecord/lib/active_record/associations')
-rw-r--r--activerecord/lib/active_record/associations/builder/association.rb4
-rw-r--r--activerecord/lib/active_record/associations/builder/collection_association.rb10
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) }