aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test/models/user.rb
diff options
context:
space:
mode:
authorRyuta Kamizono <kamipo@gmail.com>2017-01-29 05:43:45 +0900
committerRyuta Kamizono <kamipo@gmail.com>2017-02-01 06:27:23 +0900
commit111ccc832bc977b15af12c14e7ca078dad2d4373 (patch)
tree640fa3c6f1b6d2553f689399e57873ef11a06bed /activerecord/test/models/user.rb
parenta57b5292b0987c62d8567b253c9b54dc84b560d6 (diff)
downloadrails-111ccc832bc977b15af12c14e7ca078dad2d4373.tar.gz
rails-111ccc832bc977b15af12c14e7ca078dad2d4373.tar.bz2
rails-111ccc832bc977b15af12c14e7ca078dad2d4373.zip
Chain scope constraints should respect own table alias
Fixes #27666.
Diffstat (limited to 'activerecord/test/models/user.rb')
-rw-r--r--activerecord/test/models/user.rb4
1 files changed, 4 insertions, 0 deletions
diff --git a/activerecord/test/models/user.rb b/activerecord/test/models/user.rb
index c099c57e37..5089a795f4 100644
--- a/activerecord/test/models/user.rb
+++ b/activerecord/test/models/user.rb
@@ -7,6 +7,10 @@ class User < ActiveRecord::Base
has_and_belongs_to_many :jobs_pool,
class_name: "Job",
join_table: "jobs_pool"
+
+ has_one :family_tree, -> { where(token: nil) }, foreign_key: "member_id"
+ has_one :family, through: :family_tree
+ has_many :family_members, through: :family, source: :members
end
class UserWithNotification < User