aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib
diff options
context:
space:
mode:
authorAaron Patterson <aaron.patterson@gmail.com>2013-08-01 11:30:29 -0700
committerAaron Patterson <aaron.patterson@gmail.com>2013-08-01 11:43:52 -0700
commitfaf4a39cf6d9b25727efde2550dfbbf79dd5925a (patch)
treea5c1be89753fb18a3f8cb64fc720bddb75e1d45c /activerecord/lib
parent86588f9bc4d6214a8e625f97fcadb246592c41c0 (diff)
downloadrails-faf4a39cf6d9b25727efde2550dfbbf79dd5925a.tar.gz
rails-faf4a39cf6d9b25727efde2550dfbbf79dd5925a.tar.bz2
rails-faf4a39cf6d9b25727efde2550dfbbf79dd5925a.zip
make mutation method apis more consistent
Diffstat (limited to 'activerecord/lib')
-rw-r--r--activerecord/lib/active_record/associations/builder/association.rb5
-rw-r--r--activerecord/lib/active_record/associations/builder/singular_association.rb4
2 files changed, 5 insertions, 4 deletions
diff --git a/activerecord/lib/active_record/associations/builder/association.rb b/activerecord/lib/active_record/associations/builder/association.rb
index 76c91ecb72..84c340db26 100644
--- a/activerecord/lib/active_record/associations/builder/association.rb
+++ b/activerecord/lib/active_record/associations/builder/association.rb
@@ -27,7 +27,7 @@ module ActiveRecord::Associations::Builder
builder = new(model, name, scope, options, &block)
reflection = builder.build
- builder.define_accessors model.generated_feature_methods
+ builder.define_accessors model
builder.define_callbacks model, reflection
builder.define_extensions model
reflection
@@ -86,7 +86,8 @@ module ActiveRecord::Associations::Builder
#
# Post.first.comments and Post.first.comments= methods are defined by this method...
- def define_accessors(mixin)
+ def define_accessors(model)
+ mixin = model.generated_feature_methods
define_readers(mixin)
define_writers(mixin)
end
diff --git a/activerecord/lib/active_record/associations/builder/singular_association.rb b/activerecord/lib/active_record/associations/builder/singular_association.rb
index 5f0c3e0fdf..d97c0e9afd 100644
--- a/activerecord/lib/active_record/associations/builder/singular_association.rb
+++ b/activerecord/lib/active_record/associations/builder/singular_association.rb
@@ -10,9 +10,9 @@ module ActiveRecord::Associations::Builder
true
end
- def define_accessors(mixin)
+ def define_accessors(model)
super
- define_constructors(mixin) if constructable?
+ define_constructors(model.generated_feature_methods) if constructable?
end
# Defines the (build|create)_association methods for belongs_to or has_one association