diff options
author | David Heinemeier Hansson <david@loudthinking.com> | 2005-04-19 16:32:57 +0000 |
---|---|---|
committer | David Heinemeier Hansson <david@loudthinking.com> | 2005-04-19 16:32:57 +0000 |
commit | 6f34400086857bf1ed790e8a46f10be5debe5d53 (patch) | |
tree | 4edce4e9dea167912cf54d1e2568d800d426fbe1 /activerecord/test/associations_go_eager_test.rb | |
parent | 71a616890bb3557764d6a6731fd3ec9e63220a5b (diff) | |
download | rails-6f34400086857bf1ed790e8a46f10be5debe5d53.tar.gz rails-6f34400086857bf1ed790e8a46f10be5debe5d53.tar.bz2 rails-6f34400086857bf1ed790e8a46f10be5debe5d53.zip |
Fixed order of loading in eager associations
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@1229 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'activerecord/test/associations_go_eager_test.rb')
-rw-r--r-- | activerecord/test/associations_go_eager_test.rb | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/activerecord/test/associations_go_eager_test.rb b/activerecord/test/associations_go_eager_test.rb index 20ea9656b8..a3e819e028 100644 --- a/activerecord/test/associations_go_eager_test.rb +++ b/activerecord/test/associations_go_eager_test.rb @@ -17,6 +17,13 @@ class EagerAssociationTest < Test::Unit::TestCase assert post.comments.include?(@greetings) end + def test_with_ordering + posts = Post.find(:all, :include => :comments, :order => "posts.id DESC") + assert_equal @authorless, posts[0] + assert_equal @thinking, posts[1] + assert_equal @welcome, posts[2] + end + def test_loading_with_multiple_associations posts = Post.find(:all, :include => [ :comments, :author, :categories ], :order => "posts.id") assert_equal 2, posts.first.comments.size @@ -25,7 +32,7 @@ class EagerAssociationTest < Test::Unit::TestCase end def test_loading_from_an_association - posts = @david.posts.find(:all, :include => :comments, :order => "posts.id DESC") + posts = @david.posts.find(:all, :include => :comments, :order => "posts.id") assert_equal 2, posts.first.comments.size end |