diff options
author | Aaron Patterson <aaron.patterson@gmail.com> | 2013-01-24 14:29:03 -0800 |
---|---|---|
committer | Aaron Patterson <aaron.patterson@gmail.com> | 2013-01-24 14:29:03 -0800 |
commit | 170fb5c80c990688f5f372a3ba0e6cb75fb6edf0 (patch) | |
tree | 94d393965d681c1ac236a9eb183ba7990be28065 /activerecord/test/cases | |
parent | de6a35b38a6e633e7639de25f6a83c7892fe8a01 (diff) | |
download | rails-170fb5c80c990688f5f372a3ba0e6cb75fb6edf0.tar.gz rails-170fb5c80c990688f5f372a3ba0e6cb75fb6edf0.tar.bz2 rails-170fb5c80c990688f5f372a3ba0e6cb75fb6edf0.zip |
reduce the number of queries on IN clauses, fix relation queries in `where`
Diffstat (limited to 'activerecord/test/cases')
-rw-r--r-- | activerecord/test/cases/relation/where_test.rb | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/activerecord/test/cases/relation/where_test.rb b/activerecord/test/cases/relation/where_test.rb index f69a248491..c43c7601a2 100644 --- a/activerecord/test/cases/relation/where_test.rb +++ b/activerecord/test/cases/relation/where_test.rb @@ -8,7 +8,20 @@ require 'models/edge' module ActiveRecord class WhereTest < ActiveRecord::TestCase - fixtures :posts, :edges + fixtures :posts, :edges, :authors + + def test_where_copies_bind_params + author = authors(:david) + posts = author.posts.where('posts.id != 1') + joined = Post.where(id: posts) + + assert_operator joined.length, :>, 0 + + joined.each { |post| + assert_equal author, post.author + assert_not_equal 1, post.id + } + end def test_belongs_to_shallow_where author = Author.new |