aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test/cases
diff options
context:
space:
mode:
authorRafael Mendonça França <rafaelmfranca@gmail.com>2013-09-12 20:08:00 -0300
committerRafael Mendonça França <rafaelmfranca@gmail.com>2013-09-12 20:08:00 -0300
commit4aa89eda065eb8d1ed16df72804c15a1a41719fa (patch)
tree99d8071159e757b1713e4452c5639fdb4c6fcbeb /activerecord/test/cases
parentb26224899734dd0193d85a542faf1e6f4a28ad14 (diff)
parent87a84d3263c8712f85e70c45803203fa54658a9e (diff)
downloadrails-4aa89eda065eb8d1ed16df72804c15a1a41719fa.tar.gz
rails-4aa89eda065eb8d1ed16df72804c15a1a41719fa.tar.bz2
rails-4aa89eda065eb8d1ed16df72804c15a1a41719fa.zip
Merge pull request #12156 from rywall/from-copy-binds
Allow Relation#from to accept other relations with bind values. Conflicts: activerecord/CHANGELOG.md
Diffstat (limited to 'activerecord/test/cases')
-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 b3ca45c4c8..88a12c61df 100644
--- a/activerecord/test/cases/relations_test.rb
+++ b/activerecord/test/cases/relations_test.rb
@@ -139,6 +139,13 @@ class RelationTest < ActiveRecord::TestCase
assert_equal relation.to_a, Topic.select('a.*').from(relation, :a).to_a
end
+ def test_finding_with_subquery_with_binds
+ relation = Post.first.comments
+ assert_equal relation.to_a, Comment.select('*').from(relation).to_a
+ assert_equal relation.to_a, Comment.select('subquery.*').from(relation).to_a
+ assert_equal relation.to_a, Comment.select('a.*').from(relation, :a).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)