diff options
author | Ryuta Kamizono <kamipo@gmail.com> | 2017-04-13 07:56:17 +0900 |
---|---|---|
committer | Ryuta Kamizono <kamipo@gmail.com> | 2017-04-13 07:56:17 +0900 |
commit | 58d52171bb8c7a5589bb13ce1bab81d635ae9cf0 (patch) | |
tree | 3e71eb1e93fd09aeef86eb4893b5c92f3a81d718 /activerecord/test | |
parent | faca40dfd4032bbe2373210255eb7aa1c6527503 (diff) | |
download | rails-58d52171bb8c7a5589bb13ce1bab81d635ae9cf0.tar.gz rails-58d52171bb8c7a5589bb13ce1bab81d635ae9cf0.tar.bz2 rails-58d52171bb8c7a5589bb13ce1bab81d635ae9cf0.zip |
Add a test case for #20802
The issue #20802 has been fixed in cc0b566.
Closes #20802.
Diffstat (limited to 'activerecord/test')
-rw-r--r-- | activerecord/test/cases/relation/where_test.rb | 5 | ||||
-rw-r--r-- | activerecord/test/models/essay.rb | 1 |
2 files changed, 6 insertions, 0 deletions
diff --git a/activerecord/test/cases/relation/where_test.rb b/activerecord/test/cases/relation/where_test.rb index c7b2ac90fb..cbc466d6b8 100644 --- a/activerecord/test/cases/relation/where_test.rb +++ b/activerecord/test/cases/relation/where_test.rb @@ -289,6 +289,11 @@ module ActiveRecord assert_equal essays(:david_modest_proposal), essay end + def test_where_on_association_with_select_relation + essay = Essay.where(author: Author.where(name: "David").select(:name)).take + assert_equal essays(:david_modest_proposal), essay + end + def test_where_with_strong_parameters protected_params = Class.new do attr_reader :permitted diff --git a/activerecord/test/models/essay.rb b/activerecord/test/models/essay.rb index 13267fbc21..1f9772870e 100644 --- a/activerecord/test/models/essay.rb +++ b/activerecord/test/models/essay.rb @@ -1,4 +1,5 @@ class Essay < ActiveRecord::Base + belongs_to :author belongs_to :writer, primary_key: :name, polymorphic: true belongs_to :category, primary_key: :name has_one :owner, primary_key: :name |