diff options
author | Santiago Pastorino <santiago@wyeworks.com> | 2011-07-05 09:41:09 -0700 |
---|---|---|
committer | Santiago Pastorino <santiago@wyeworks.com> | 2011-07-05 09:41:09 -0700 |
commit | b27871a66fc1568dba08a4fbc1e6f20dec5dccab (patch) | |
tree | db3e72850658c042bb54a4d8d0d33772be64d7c6 /activerecord/test/cases/associations/has_many_associations_test.rb | |
parent | eb2e109b7e60bb8fa524558336f58a547473063d (diff) | |
parent | 8ba0c1ac5315c24cd7132267152b9d126c6ddf52 (diff) | |
download | rails-b27871a66fc1568dba08a4fbc1e6f20dec5dccab.tar.gz rails-b27871a66fc1568dba08a4fbc1e6f20dec5dccab.tar.bz2 rails-b27871a66fc1568dba08a4fbc1e6f20dec5dccab.zip |
Merge pull request #1968 from bogdan/associations_find_array_compatibility2
Fixed CollectionAssociation#find to be compatible with Array#find
Diffstat (limited to 'activerecord/test/cases/associations/has_many_associations_test.rb')
-rw-r--r-- | activerecord/test/cases/associations/has_many_associations_test.rb | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/activerecord/test/cases/associations/has_many_associations_test.rb b/activerecord/test/cases/associations/has_many_associations_test.rb index 7e331658a3..a2764f3e3b 100644 --- a/activerecord/test/cases/associations/has_many_associations_test.rb +++ b/activerecord/test/cases/associations/has_many_associations_test.rb @@ -226,6 +226,10 @@ class HasManyAssociationsTest < ActiveRecord::TestCase assert_equal 2, Firm.find(:first, :order => "id").clients.length end + def test_finding_array_compatibility + assert_equal 2, Firm.order(:id).find{|f| f.id > 0}.clients.length + end + def test_find_with_blank_conditions [[], {}, nil, ""].each do |blank| assert_equal 2, Firm.find(:first, :order => "id").clients.find(:all, :conditions => blank).size |