From 847e9a95da59f1263e6e5c15cd5ce5c9ec8260a6 Mon Sep 17 00:00:00 2001 From: Cody Cutrer Date: Mon, 16 Dec 2013 21:26:37 -0700 Subject: fix default select when from is used --- activerecord/test/cases/relations_test.rb | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'activerecord/test') diff --git a/activerecord/test/cases/relations_test.rb b/activerecord/test/cases/relations_test.rb index 2ccf4c7578..031da8e6d6 100644 --- a/activerecord/test/cases/relations_test.rb +++ b/activerecord/test/cases/relations_test.rb @@ -151,6 +151,11 @@ class RelationTest < ActiveRecord::TestCase assert_equal relation.to_a, Comment.select('a.*').from(relation, :a).to_a end + def test_finding_with_subquery_without_select + relation = Topic.where(:approved => true) + assert_equal relation.to_a, Topic.from(relation).to_a + end + def test_finding_with_conditions assert_equal ["David"], Author.where(:name => 'David').map(&:name) assert_equal ['Mary'], Author.where(["name = ?", 'Mary']).map(&:name) -- cgit v1.2.3