diff options
author | Ryuta Kamizono <kamipo@gmail.com> | 2017-10-09 15:18:59 +0900 |
---|---|---|
committer | Ryuta Kamizono <kamipo@gmail.com> | 2017-10-09 16:06:04 +0900 |
commit | c5ab6e51a7b9ee05a2d262a72c7130b9c1d1b0ce (patch) | |
tree | 2d8ac7f3e896045390ec35455cf61a0bc25275f5 /activerecord/test/models | |
parent | b1e7bb9ed7ddbb29fd788dee1c3f2ba2626bd7ac (diff) | |
download | rails-c5ab6e51a7b9ee05a2d262a72c7130b9c1d1b0ce.tar.gz rails-c5ab6e51a7b9ee05a2d262a72c7130b9c1d1b0ce.tar.bz2 rails-c5ab6e51a7b9ee05a2d262a72c7130b9c1d1b0ce.zip |
Joined tables in association scope doesn't use the same aliases with the parent relation's aliases
Building association scope in join dependency should respect the parent
relation's aliases to avoid using the same alias name more than once.
Fixes #30681.
Diffstat (limited to 'activerecord/test/models')
-rw-r--r-- | activerecord/test/models/author.rb | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/activerecord/test/models/author.rb b/activerecord/test/models/author.rb index 3371fcbfcc..e9eba9be2e 100644 --- a/activerecord/test/models/author.rb +++ b/activerecord/test/models/author.rb @@ -22,6 +22,7 @@ class Author < ActiveRecord::Base has_many :comments_containing_the_letter_e, through: :posts, source: :comments has_many :comments_with_order_and_conditions, -> { order("comments.body").where("comments.body like 'Thank%'") }, through: :posts, source: :comments has_many :comments_with_include, -> { includes(:post).where(posts: { type: "Post" }) }, through: :posts, source: :comments + has_many :comments_for_first_author, -> { for_first_author }, through: :posts, source: :comments has_many :first_posts has_many :comments_on_first_posts, -> { order("posts.id desc, comments.id asc") }, through: :first_posts, source: :comments |