From 277c799d58be4b3e0e885d7b3fd6d954facc111b Mon Sep 17 00:00:00 2001 From: Jan De Poorter Date: Mon, 9 Mar 2009 13:02:31 +0100 Subject: Fix find_by_last when order is given [#2127 state:committed] Signed-off-by: David Heinemeier Hansson --- activerecord/test/cases/associations/has_many_associations_test.rb | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'activerecord/test/cases/associations/has_many_associations_test.rb') diff --git a/activerecord/test/cases/associations/has_many_associations_test.rb b/activerecord/test/cases/associations/has_many_associations_test.rb index 3f33baf88c..b7fa9d9d7c 100644 --- a/activerecord/test/cases/associations/has_many_associations_test.rb +++ b/activerecord/test/cases/associations/has_many_associations_test.rb @@ -70,6 +70,10 @@ class HasManyAssociationsTest < ActiveRecord::TestCase assert_equal 2, companies(:first_firm).limited_clients.find(:all, :limit => nil).size end + def test_dynamic_find_last_without_specified_order + assert_equal companies(:second_client), companies(:first_firm).unsorted_clients.find_last_by_type('Client') + end + def test_dynamic_find_should_respect_association_order assert_equal companies(:second_client), companies(:first_firm).clients_sorted_desc.find(:first, :conditions => "type = 'Client'") assert_equal companies(:second_client), companies(:first_firm).clients_sorted_desc.find_by_type('Client') -- cgit v1.2.3