aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test/cases/associations/has_many_through_associations_test.rb
diff options
context:
space:
mode:
authorJon Leighton <j@jonathanleighton.com>2012-07-27 12:01:25 +0100
committerJon Leighton <j@jonathanleighton.com>2012-07-27 13:34:12 +0100
commit6a81ccd69d96f36f4322ef927191ab5a35e68d68 (patch)
treeeefd3b92255fa3969e412c88633332a47808f3c5 /activerecord/test/cases/associations/has_many_through_associations_test.rb
parentf1afd7765c2a35cc77e1ee40466db36f181e29f5 (diff)
downloadrails-6a81ccd69d96f36f4322ef927191ab5a35e68d68.tar.gz
rails-6a81ccd69d96f36f4322ef927191ab5a35e68d68.tar.bz2
rails-6a81ccd69d96f36f4322ef927191ab5a35e68d68.zip
ActiveRecord::Base.all returns a Relation.
Previously it returned an Array. If you want an array, call e.g. `Post.to_a` rather than `Post.all`. This is more explicit. In most cases this should not break existing code, since Relations use method_missing to delegate unknown methods to #to_a anyway.
Diffstat (limited to 'activerecord/test/cases/associations/has_many_through_associations_test.rb')
-rw-r--r--activerecord/test/cases/associations/has_many_through_associations_test.rb4
1 files changed, 2 insertions, 2 deletions
diff --git a/activerecord/test/cases/associations/has_many_through_associations_test.rb b/activerecord/test/cases/associations/has_many_through_associations_test.rb
index 94848f1044..36e5ba9660 100644
--- a/activerecord/test/cases/associations/has_many_through_associations_test.rb
+++ b/activerecord/test/cases/associations/has_many_through_associations_test.rb
@@ -706,7 +706,7 @@ class HasManyThroughAssociationsTest < ActiveRecord::TestCase
def test_through_association_readonly_should_be_false
assert !people(:michael).posts.first.readonly?
- assert !people(:michael).posts.all.first.readonly?
+ assert !people(:michael).posts.to_a.first.readonly?
end
def test_can_update_through_association
@@ -742,7 +742,7 @@ class HasManyThroughAssociationsTest < ActiveRecord::TestCase
end
def test_has_many_through_with_default_scope_on_join_model
- assert_equal posts(:welcome).comments.order('id').all, authors(:david).comments_on_first_posts
+ assert_equal posts(:welcome).comments.order('id').to_a, authors(:david).comments_on_first_posts
end
def test_create_has_many_through_with_default_scope_on_join_model