aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord
diff options
context:
space:
mode:
authorNeeraj Singh <neerajdotname@gmail.com>2010-06-21 16:40:45 -0400
committerJosé Valim <jose.valim@gmail.com>2010-06-22 18:04:38 +0200
commit7033be5f72a2b68223eff5d3946aba51e80b4c0c (patch)
tree16c25e1d6a6abb77ec6f417cc254621ada2b9394 /activerecord
parentec37452f6839d13181a90cf0d4944dc8f97fa1d9 (diff)
downloadrails-7033be5f72a2b68223eff5d3946aba51e80b4c0c.tar.gz
rails-7033be5f72a2b68223eff5d3946aba51e80b4c0c.tar.bz2
rails-7033be5f72a2b68223eff5d3946aba51e80b4c0c.zip
test for #4917
Signed-off-by: José Valim <jose.valim@gmail.com>
Diffstat (limited to 'activerecord')
-rw-r--r--activerecord/test/cases/relations_test.rb7
1 files changed, 7 insertions, 0 deletions
diff --git a/activerecord/test/cases/relations_test.rb b/activerecord/test/cases/relations_test.rb
index ece287d771..165b2e1e6c 100644
--- a/activerecord/test/cases/relations_test.rb
+++ b/activerecord/test/cases/relations_test.rb
@@ -16,6 +16,13 @@ class RelationTest < ActiveRecord::TestCase
fixtures :authors, :topics, :entrants, :developers, :companies, :developers_projects, :accounts, :categories, :categorizations, :posts, :comments,
:taggings
+ def test_apply_relation_as_where_id
+ posts = Post.arel_table
+ post_authors = posts.where(posts[:author_id].eq(1)).project(posts[:id])
+ assert_equal 5, post_authors.to_a.size
+ assert_equal 5, Post.where(:id => post_authors).size
+ end
+
def test_scoped
topics = Topic.scoped
assert_kind_of ActiveRecord::Relation, topics