aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test/cases/associations/has_many_associations_test.rb
diff options
context:
space:
mode:
authorBogdan Gusiev <agresso@gmail.com>2012-07-31 10:24:18 +0300
committerBogdan Gusiev <agresso@gmail.com>2012-07-31 10:24:18 +0300
commit92641efeecae0910c6292c0c6bf071197b24e63d (patch)
treeda8e0b8ad3660b3b0670d05959f233a414a0836a /activerecord/test/cases/associations/has_many_associations_test.rb
parent10cdeb867bb4b5534c575b0eb3f03e6719269875 (diff)
downloadrails-92641efeecae0910c6292c0c6bf071197b24e63d.tar.gz
rails-92641efeecae0910c6292c0c6bf071197b24e63d.tar.bz2
rails-92641efeecae0910c6292c0c6bf071197b24e63d.zip
AR::Relation#order: make new order prepend old one
User.order("name asc").order("created_at desc") # SELECT * FROM users ORDER BY created_at desc, name asc This also affects order defined in `default_scope` or any kind of associations.
Diffstat (limited to 'activerecord/test/cases/associations/has_many_associations_test.rb')
-rw-r--r--activerecord/test/cases/associations/has_many_associations_test.rb4
1 files changed, 2 insertions, 2 deletions
diff --git a/activerecord/test/cases/associations/has_many_associations_test.rb b/activerecord/test/cases/associations/has_many_associations_test.rb
index 6122104335..6b675d3d54 100644
--- a/activerecord/test/cases/associations/has_many_associations_test.rb
+++ b/activerecord/test/cases/associations/has_many_associations_test.rb
@@ -231,9 +231,9 @@ class HasManyAssociationsTest < ActiveRecord::TestCase
assert_equal 2, companies(:first_firm).limited_clients.limit(nil).to_a.size
end
- def test_find_should_append_to_association_order
+ def test_find_should_prepend_to_association_order
ordered_clients = companies(:first_firm).clients_sorted_desc.order('companies.id')
- assert_equal ['id DESC', 'companies.id'], ordered_clients.order_values
+ assert_equal ['companies.id', 'id DESC'], ordered_clients.order_values
end
def test_dynamic_find_should_respect_association_order