Permalink
Browse files

Just use primary_key here, AR::Relation will resolve the ambiguity be…

…fore it is converted to SQL
  • Loading branch information...
1 parent 140b269 commit 1da1ac159f9391b9a053a0fb0d426499b9edd5b7 @jonleighton jonleighton committed Jan 24, 2011
Showing with 1 addition and 1 deletion.
  1. +1 −1 activerecord/lib/active_record/associations/association_collection.rb
@@ -146,7 +146,7 @@ def count(column_name = nil, options = {})
else
if @reflection.options[:uniq]
# This is needed because 'SELECT count(DISTINCT *)..' is not valid SQL.
- column_name = "#{@reflection.quoted_table_name}.#{@reflection.klass.primary_key}" unless column_name
+ column_name ||= @reflection.klass.primary_key
options.merge!(:distinct => true)
end

0 comments on commit 1da1ac1

Please sign in to comment.