diff options
author | Rafael Mendonça França <rafaelmfranca@gmail.com> | 2013-10-08 23:56:34 -0300 |
---|---|---|
committer | Rafael Mendonça França <rafaelmfranca@gmail.com> | 2013-10-08 23:56:53 -0300 |
commit | d300256ca4dd8b6f921afe8ef2de05d7e9c084e7 (patch) | |
tree | b63765e188c3e612c36b17d736b67529c9df4c20 /activerecord/lib/active_record/associations/builder | |
parent | cae842e662bbf6d6e6c87857d6ab68a982b1663f (diff) | |
download | rails-d300256ca4dd8b6f921afe8ef2de05d7e9c084e7.tar.gz rails-d300256ca4dd8b6f921afe8ef2de05d7e9c084e7.tar.bz2 rails-d300256ca4dd8b6f921afe8ef2de05d7e9c084e7.zip |
Use the reflection name instead of the accessor
Diffstat (limited to 'activerecord/lib/active_record/associations/builder')
-rw-r--r-- | activerecord/lib/active_record/associations/builder/association.rb | 1 | ||||
-rw-r--r-- | activerecord/lib/active_record/associations/builder/singular_association.rb | 2 |
2 files changed, 2 insertions, 1 deletions
diff --git a/activerecord/lib/active_record/associations/builder/association.rb b/activerecord/lib/active_record/associations/builder/association.rb index dc1fec17bf..fa46ea060e 100644 --- a/activerecord/lib/active_record/associations/builder/association.rb +++ b/activerecord/lib/active_record/associations/builder/association.rb @@ -86,6 +86,7 @@ module ActiveRecord::Associations::Builder # Post.first.comments and Post.first.comments= methods are defined by this method... def define_accessors(model, reflection) mixin = model.generated_feature_methods + name = reflection.name self.class.define_readers(mixin, name) self.class.define_writers(mixin, name) end diff --git a/activerecord/lib/active_record/associations/builder/singular_association.rb b/activerecord/lib/active_record/associations/builder/singular_association.rb index 24429628bc..4dc45d4d25 100644 --- a/activerecord/lib/active_record/associations/builder/singular_association.rb +++ b/activerecord/lib/active_record/associations/builder/singular_association.rb @@ -8,7 +8,7 @@ module ActiveRecord::Associations::Builder def define_accessors(model, reflection) super - self.class.define_constructors(model.generated_feature_methods, name) if reflection.constructable? + self.class.define_constructors(model.generated_feature_methods, reflection.name) if reflection.constructable? end # Defines the (build|create)_association methods for belongs_to or has_one association |