diff options
author | Dan Erikson <derikson3@gmail.com> | 2013-04-08 00:41:16 -0600 |
---|---|---|
committer | Dan Erikson <derikson3@gmail.com> | 2013-04-08 00:41:16 -0600 |
commit | a8ede3664055f33c102b3f229cf280b0bf69c540 (patch) | |
tree | c83e394dbdc279ba21c9d4d11ca243af24482feb /activerecord/test/cases/associations | |
parent | a92814b001d93f8ef533e692011bbc8824841bf7 (diff) | |
download | rails-a8ede3664055f33c102b3f229cf280b0bf69c540.tar.gz rails-a8ede3664055f33c102b3f229cf280b0bf69c540.tar.bz2 rails-a8ede3664055f33c102b3f229cf280b0bf69c540.zip |
Changed ActiveRecord::Associations::CollectionProxy#select to take multiple arguments.
This makes the arguments the same as ActiveRecord::QueryMethods::select.
Diffstat (limited to 'activerecord/test/cases/associations')
-rw-r--r-- | activerecord/test/cases/associations/has_many_associations_test.rb | 6 |
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 781b87741d..7c50c18763 100644 --- a/activerecord/test/cases/associations/has_many_associations_test.rb +++ b/activerecord/test/cases/associations/has_many_associations_test.rb @@ -523,7 +523,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_adding |