From 796ec652ade1bfbf074fc1cfd2cd2e7794f494bc Mon Sep 17 00:00:00 2001 From: Emilio Tagua Date: Fri, 14 Aug 2009 15:59:55 -0300 Subject: Don't use regular rinder on calculations since scoping order blows PostreSQL. --- activerecord/lib/active_record/calculations.rb | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'activerecord/lib/active_record') diff --git a/activerecord/lib/active_record/calculations.rb b/activerecord/lib/active_record/calculations.rb index ab501dac33..658101d8ee 100644 --- a/activerecord/lib/active_record/calculations.rb +++ b/activerecord/lib/active_record/calculations.rb @@ -146,7 +146,13 @@ module ActiveRecord join_dependency = ActiveRecord::Associations::ClassMethods::JoinDependency.new(self, merged_includes, construct_join(options[:joins], scope)) construct_finder_arel_with_included_associations(options, join_dependency) else - construct_finder_arel(options) + arel_table(options[:from]). + join(construct_join(options[:joins], scope)). + where(construct_conditions(options[:conditions], scope)). + group(construct_group(options[:group], options[:having], scope)). + order(options[:order]). + take(options[:limit]). + skip(options[:offset]) end if options[:group] return execute_grouped_calculation(operation, column_name, options, relation) -- cgit v1.2.3