aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib
diff options
context:
space:
mode:
authorclaudiob <claudiob@gmail.com>2015-02-06 10:50:44 -0800
committerclaudiob <claudiob@gmail.com>2015-02-06 10:50:44 -0800
commit124d4d59a09235fa319486caa0c8e12dafe9b92f (patch)
tree2d7cf2210b0cfd5cc6723929fc27c04b97a10c1f /activerecord/lib
parent0f67f00d94aca0b65856a4305792997c6a34fff9 (diff)
downloadrails-124d4d59a09235fa319486caa0c8e12dafe9b92f.tar.gz
rails-124d4d59a09235fa319486caa0c8e12dafe9b92f.tar.bz2
rails-124d4d59a09235fa319486caa0c8e12dafe9b92f.zip
Do not use the same name for two `:belongs_to`
A model cannot have two `:belongs_to` with the same exact name, so we are better off avoiding this code in our examples, which might mislead users in thinking it's admissible. [ci skip]
Diffstat (limited to 'activerecord/lib')
-rw-r--r--activerecord/lib/active_record/associations.rb6
1 files changed, 3 insertions, 3 deletions
diff --git a/activerecord/lib/active_record/associations.rb b/activerecord/lib/active_record/associations.rb
index 35bc09bb10..9aa5fb5e26 100644
--- a/activerecord/lib/active_record/associations.rb
+++ b/activerecord/lib/active_record/associations.rb
@@ -1434,7 +1434,7 @@ module ActiveRecord
# when you access the associated object.
#
# Scope examples:
- # belongs_to :user, -> { where(id: 2) }
+ # belongs_to :firm, -> { where(id: 2) }
# belongs_to :user, -> { joins(:friends) }
# belongs_to :level, ->(level) { where("game_level > ?", level.current) }
#
@@ -1512,9 +1512,9 @@ module ActiveRecord
# belongs_to :attachable, polymorphic: true
# belongs_to :project, readonly: true
# belongs_to :post, counter_cache: true
- # belongs_to :company, touch: true
+ # belongs_to :comment, touch: true
# belongs_to :company, touch: :employees_last_updated_at
- # belongs_to :company, required: true
+ # belongs_to :user, required: true
def belongs_to(name, scope = nil, options = {})
reflection = Builder::BelongsTo.build(self, name, scope, options)
Reflection.add_reflection self, name, reflection