diff options
author | Emilio Tagua <miloops@gmail.com> | 2010-06-22 10:46:12 -0300 |
---|---|---|
committer | José Valim <jose.valim@gmail.com> | 2010-06-22 16:44:10 +0200 |
commit | 7df105b1e604846f5dfe184128f99499da477bbe (patch) | |
tree | 2f407e11d2110bc993f981e36dba03973a916466 /activerecord/test | |
parent | df595b577edf807c3b9315feb882d12d9b249af9 (diff) | |
download | rails-7df105b1e604846f5dfe184128f99499da477bbe.tar.gz rails-7df105b1e604846f5dfe184128f99499da477bbe.tar.bz2 rails-7df105b1e604846f5dfe184128f99499da477bbe.zip |
Fix order method to accept relation attributes.
Signed-off-by: José Valim <jose.valim@gmail.com>
Diffstat (limited to 'activerecord/test')
-rw-r--r-- | activerecord/test/cases/relations_test.rb | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/activerecord/test/cases/relations_test.rb b/activerecord/test/cases/relations_test.rb index 43519db976..ece287d771 100644 --- a/activerecord/test/cases/relations_test.rb +++ b/activerecord/test/cases/relations_test.rb @@ -503,13 +503,13 @@ class RelationTest < ActiveRecord::TestCase def test_many posts = Post.scoped - + assert_queries(2) do assert posts.many? # Uses COUNT() assert posts.many? {|p| p.id > 0 } assert ! posts.many? {|p| p.id < 2 } end - + assert posts.loaded? end @@ -593,4 +593,8 @@ class RelationTest < ActiveRecord::TestCase assert_equal "lifo", relation.author assert_equal "lifo", relation.limit(1).author end + + def test_order_by_relation_attribute + assert_equal Post.order(Post.arel_table[:title]).all, Post.order("title").all + end end |