From 4394e402b7a482675ceb5ab9e832defe930bd71e Mon Sep 17 00:00:00 2001 From: David Heinemeier Hansson Date: Sat, 3 Jun 2006 21:19:36 +0000 Subject: Fixed that count distinct should use the selected column even when using :include (closes #5251) [anna@wota.jp] git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@4417 5ecf4fe2-1ee6-0310-87b1-e25e094e27de --- activerecord/test/calculations_test.rb | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'activerecord/test') diff --git a/activerecord/test/calculations_test.rb b/activerecord/test/calculations_test.rb index c4e41b1dda..785a4d10b4 100644 --- a/activerecord/test/calculations_test.rb +++ b/activerecord/test/calculations_test.rb @@ -187,4 +187,9 @@ class CalculationsTest < Test::Unit::TestCase assert_raises(ArgumentError) { Company.send(:validate_calculation_options, :sum, :foo => :bar) } assert_raises(ArgumentError) { Company.send(:validate_calculation_options, :count, :foo => :bar) } end + + def test_should_count_selected_field_with_include + assert_equal 5, Account.count(:distinct => true, :include => :firm) + assert_equal 3, Account.count(:distinct => true, :include => :firm, :select => :credit_limit) + end end -- cgit v1.2.3