diff options
author | Emilio Tagua <miloops@gmail.com> | 2009-10-07 12:43:04 -0300 |
---|---|---|
committer | Emilio Tagua <miloops@gmail.com> | 2009-10-07 12:43:04 -0300 |
commit | 9a958a3d7dc1640c90abbe1164d7ccb7ea9ae685 (patch) | |
tree | e4506fe2ccdbe51894d2e4d0d47f37e79545d603 /activerecord/test/cases | |
parent | aadb09b13bf2ca2eab4569f187e1cc42b007ba33 (diff) | |
download | rails-9a958a3d7dc1640c90abbe1164d7ccb7ea9ae685.tar.gz rails-9a958a3d7dc1640c90abbe1164d7ccb7ea9ae685.tar.bz2 rails-9a958a3d7dc1640c90abbe1164d7ccb7ea9ae685.zip |
Relations: Added offset when finding with associations. Delegate array instance
methods to to_a.
Diffstat (limited to 'activerecord/test/cases')
-rw-r--r-- | activerecord/test/cases/relations_test.rb | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/activerecord/test/cases/relations_test.rb b/activerecord/test/cases/relations_test.rb index 54b72554b9..4833d04aff 100644 --- a/activerecord/test/cases/relations_test.rb +++ b/activerecord/test/cases/relations_test.rb @@ -122,12 +122,12 @@ class RelationTest < ActiveRecord::TestCase end def test_default_scope_with_conditions_hash - assert_equal Developer.find_all_by_name('Jamis').map(&:id).sort, DeveloperCalledJamis.all.to_a.map(&:id).sort + assert_equal Developer.find_all_by_name('Jamis').map(&:id).sort, DeveloperCalledJamis.all.map(&:id).sort assert_equal 'Jamis', DeveloperCalledJamis.create!.name end def test_loading_with_one_association - posts = Post.all(:include => :comments).to_a + posts = Post.all(:include => :comments) post = posts.find { |p| p.id == 1 } assert_equal 2, post.comments.size assert post.comments.include?(comments(:greetings)) @@ -136,16 +136,15 @@ class RelationTest < ActiveRecord::TestCase assert_equal 2, post.comments.size assert post.comments.include?(comments(:greetings)) - posts = Post.all(:include => :last_comment).to_a + posts = Post.all(:include => :last_comment) post = posts.find { |p| p.id == 1 } assert_equal Post.find(1).last_comment, post.last_comment end def test_loading_with_one_association_with_non_preload - posts = Post.all(:include => :last_comment, :order => 'comments.id DESC').to_a + posts = Post.all(:include => :last_comment, :order => 'comments.id DESC') post = posts.find { |p| p.id == 1 } assert_equal Post.find(1).last_comment, post.last_comment end - end |