aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test
diff options
context:
space:
mode:
authorRafael Mendonça França <rafaelmfranca@gmail.com>2014-01-03 13:03:19 -0800
committerRafael Mendonça França <rafaelmfranca@gmail.com>2014-01-03 13:03:19 -0800
commit19b2188e6c53a0c2ce43567950ff699e58b33798 (patch)
treee12d0aaf0b1dfdb9b8a7ce0b708fa755ad9b1d02 /activerecord/test
parentf89266ace88b489a6af48fa4ae749a0e159112b6 (diff)
parenta8ede3664055f33c102b3f229cf280b0bf69c540 (diff)
downloadrails-19b2188e6c53a0c2ce43567950ff699e58b33798.tar.gz
rails-19b2188e6c53a0c2ce43567950ff699e58b33798.tar.bz2
rails-19b2188e6c53a0c2ce43567950ff699e58b33798.zip
Merge pull request #10134 from derikson/collection_proxy_select_with_multiple_args
Change CollectionProxy#select to take the same arguments as ActiveRecord::select
Diffstat (limited to 'activerecord/test')
-rw-r--r--activerecord/test/cases/associations/has_many_associations_test.rb6
1 files changed, 5 insertions, 1 deletions
diff --git a/activerecord/test/cases/associations/has_many_associations_test.rb b/activerecord/test/cases/associations/has_many_associations_test.rb
index c6291e8aa4..e45efb0161 100644
--- a/activerecord/test/cases/associations/has_many_associations_test.rb
+++ b/activerecord/test/cases/associations/has_many_associations_test.rb
@@ -455,7 +455,11 @@ class HasManyAssociationsTest < ActiveRecord::TestCase
end
def test_select_query_method
- assert_equal ['id'], posts(:welcome).comments.select(:id).first.attributes.keys
+ assert_equal ['id', 'body'], posts(:welcome).comments.select(:id, :body).first.attributes.keys
+ end
+
+ def test_select_with_block
+ assert_equal [1], posts(:welcome).comments.select { |c| c.id == 1 }.map(&:id)
end
def test_select_without_foreign_key