aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord
diff options
context:
space:
mode:
authorFrederick Cheung <frederick.cheung@gmail.com>2008-04-21 11:47:15 +1200
committerMichael Koziarski <michael@koziarski.com>2008-04-21 11:47:15 +1200
commit55622e0bde999193ae4a848d28cf2ce7e9247d83 (patch)
tree3723491acf1fec3d00c34bc46aa6ac54e9afee65 /activerecord
parenta2028a7d7bf4336d01656d947df77ee504927db0 (diff)
downloadrails-55622e0bde999193ae4a848d28cf2ce7e9247d83.tar.gz
rails-55622e0bde999193ae4a848d28cf2ce7e9247d83.tar.bz2
rails-55622e0bde999193ae4a848d28cf2ce7e9247d83.zip
Avoid adding two DISTINCT statements to queries in sqlite 2.
Diffstat (limited to 'activerecord')
-rw-r--r--activerecord/lib/active_record/calculations.rb2
1 files changed, 1 insertions, 1 deletions
diff --git a/activerecord/lib/active_record/calculations.rb b/activerecord/lib/active_record/calculations.rb
index 64527ec3f0..b5bf82ee11 100644
--- a/activerecord/lib/active_record/calculations.rb
+++ b/activerecord/lib/active_record/calculations.rb
@@ -178,7 +178,7 @@ module ActiveRecord
sql = "SELECT COUNT(*) AS #{aggregate_alias}" if use_workaround
sql << ", #{options[:group_field]} AS #{options[:group_alias]}" if options[:group]
- sql << " FROM (SELECT DISTINCT #{column_name}" if use_workaround
+ sql << " FROM (SELECT #{distinct}#{column_name}" if use_workaround
sql << " FROM #{connection.quote_table_name(table_name)} "
if merged_includes.any?
join_dependency = ActiveRecord::Associations::ClassMethods::JoinDependency.new(self, merged_includes, options[:joins])