1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

Fix association documentation

The object inside the scope is of the class that define the association
not the associated class.

[ci skip]
This commit is contained in:
Rafael Mendonça França 2017-05-16 17:50:04 -04:00
parent ff55c6ef80
commit 0714251b2d
No known key found for this signature in database
GPG key ID: FC23B6D0F1EEE948

View file

@ -1276,7 +1276,7 @@ module ActiveRecord
# Scope examples:
# has_many :comments, -> { where(author_id: 1) }
# has_many :employees, -> { joins(:address) }
# has_many :posts, ->(post) { where("max_post_length > ?", post.length) }
# has_many :posts, ->(blog) { where("max_post_length > ?", blog.max_post_length) }
#
# === Extensions
#
@ -1443,7 +1443,7 @@ module ActiveRecord
# Scope examples:
# has_one :author, -> { where(comment_id: 1) }
# has_one :employer, -> { joins(:company) }
# has_one :dob, ->(dob) { where("Date.new(2000, 01, 01) > ?", dob) }
# has_one :latest_post, ->(blog) { where("created_at > ?", blog.enabled_at) }
#
# === Options
#
@ -1573,7 +1573,7 @@ module ActiveRecord
# Scope examples:
# belongs_to :firm, -> { where(id: 2) }
# belongs_to :user, -> { joins(:friends) }
# belongs_to :level, ->(level) { where("game_level > ?", level.current) }
# belongs_to :level, ->(game) { where("game_level > ?", game.current_level) }
#
# === Options
#
@ -1769,9 +1769,8 @@ module ActiveRecord
#
# Scope examples:
# has_and_belongs_to_many :projects, -> { includes(:milestones, :manager) }
# has_and_belongs_to_many :categories, ->(category) {
# where("default_category = ?", category.name)
# }
# has_and_belongs_to_many :categories, ->(post) {
# where("default_category = ?", post.default_category)
#
# === Extensions
#