From 44af2efa2c7391681968c827ca47201a0a02e974 Mon Sep 17 00:00:00 2001 From: Ernie Miller Date: Thu, 28 Aug 2008 14:01:42 -0400 Subject: Refactored AssociationCollection#count for uniformity and Ruby 1.8.7 support. [#831 state:resolved] Signed-off-by: Jeremy Kemper --- .../associations/has_and_belongs_to_many_associations_test.rb | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'activerecord/test/cases') diff --git a/activerecord/test/cases/associations/has_and_belongs_to_many_associations_test.rb b/activerecord/test/cases/associations/has_and_belongs_to_many_associations_test.rb index 0572418e3b..1b31d28679 100644 --- a/activerecord/test/cases/associations/has_and_belongs_to_many_associations_test.rb +++ b/activerecord/test/cases/associations/has_and_belongs_to_many_associations_test.rb @@ -703,4 +703,11 @@ class HasAndBelongsToManyAssociationsTest < ActiveRecord::TestCase # due to Unknown column 'authors.id' assert Category.find(1).posts_with_authors_sorted_by_author_id.find_by_title('Welcome to the weblog') end + + def test_counting_on_habtm_association_and_not_array + david = Developer.find(1) + # Extra parameter just to make sure we aren't falling back to + # Array#count in Ruby >=1.8.7, which would raise an ArgumentError + assert_nothing_raised { david.projects.count(:all, :conditions => '1=1') } + end end -- cgit v1.2.3