diff options
author | Jon Leighton <j@jonathanleighton.com> | 2011-01-24 23:11:38 +0000 |
---|---|---|
committer | Jon Leighton <j@jonathanleighton.com> | 2011-01-30 11:58:08 +0000 |
commit | 1da1ac159f9391b9a053a0fb0d426499b9edd5b7 (patch) | |
tree | a76994f7b43007f1a921f2381906c482d8eb7841 | |
parent | 140b269fb7aee85e6da32da5305f771099d35af5 (diff) | |
download | rails-1da1ac159f9391b9a053a0fb0d426499b9edd5b7.tar.gz rails-1da1ac159f9391b9a053a0fb0d426499b9edd5b7.tar.bz2 rails-1da1ac159f9391b9a053a0fb0d426499b9edd5b7.zip |
Just use primary_key here, AR::Relation will resolve the ambiguity before it is converted to SQL
-rw-r--r-- | activerecord/lib/active_record/associations/association_collection.rb | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/activerecord/lib/active_record/associations/association_collection.rb b/activerecord/lib/active_record/associations/association_collection.rb index 7fd15e4bd6..7504773639 100644 --- a/activerecord/lib/active_record/associations/association_collection.rb +++ b/activerecord/lib/active_record/associations/association_collection.rb @@ -146,7 +146,7 @@ module ActiveRecord 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 |