aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test/cases/associations_test.rb
diff options
context:
space:
mode:
authorAaron Patterson <aaron.patterson@gmail.com>2014-09-04 14:40:10 -0700
committerAaron Patterson <aaron.patterson@gmail.com>2014-09-04 14:40:19 -0700
commit2e6625fb775783cdbc721391be18a073a5b9a9c8 (patch)
treee9291b495ad9875fbbbeea0d0f5952a7b57250fa /activerecord/test/cases/associations_test.rb
parentc523b7c468ee9512d82243636bfac321e79535db (diff)
downloadrails-2e6625fb775783cdbc721391be18a073a5b9a9c8.tar.gz
rails-2e6625fb775783cdbc721391be18a073a5b9a9c8.tar.bz2
rails-2e6625fb775783cdbc721391be18a073a5b9a9c8.zip
always reorder bind parameters. fixes #15920
Diffstat (limited to 'activerecord/test/cases/associations_test.rb')
-rw-r--r--activerecord/test/cases/associations_test.rb9
1 files changed, 8 insertions, 1 deletions
diff --git a/activerecord/test/cases/associations_test.rb b/activerecord/test/cases/associations_test.rb
index f663b5490c..635c657d9b 100644
--- a/activerecord/test/cases/associations_test.rb
+++ b/activerecord/test/cases/associations_test.rb
@@ -23,7 +23,7 @@ require 'models/interest'
class AssociationsTest < ActiveRecord::TestCase
fixtures :accounts, :companies, :developers, :projects, :developers_projects,
- :computers, :people, :readers
+ :computers, :people, :readers, :authors, :author_favorites
def test_eager_loading_should_not_change_count_of_children
liquid = Liquid.create(:name => 'salty')
@@ -35,6 +35,13 @@ class AssociationsTest < ActiveRecord::TestCase
assert_equal 1, liquids[0].molecules.length
end
+ def test_subselect
+ author = authors :david
+ favs = author.author_favorites
+ fav2 = author.author_favorites.where(:author => Author.where(id: author.id)).to_a
+ assert_equal favs, fav2
+ end
+
def test_clear_association_cache_stored
firm = Firm.find(1)
assert_kind_of Firm, firm