diff options
Diffstat (limited to 'activerecord/lib/active_record/base.rb')
-rwxr-xr-x | activerecord/lib/active_record/base.rb | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/activerecord/lib/active_record/base.rb b/activerecord/lib/active_record/base.rb index deb3c5fc1f..e040c86505 100755 --- a/activerecord/lib/active_record/base.rb +++ b/activerecord/lib/active_record/base.rb @@ -544,7 +544,7 @@ module ActiveRecord #:nodoc: def construct_counter_sql(options) sql = "SELECT COUNT(" sql << "DISTINCT " if options[:distinct] - sql << "#{table_name}.#{primary_key}) FROM #{table_name} " + sql << "#{options[:select] || "#{table_name}.#{primary_key}"}) FROM #{table_name} " sql << " #{options[:joins]} " if options[:joins] add_conditions!(sql, options[:conditions]) sql |