aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record/calculations.rb
diff options
context:
space:
mode:
Diffstat (limited to 'activerecord/lib/active_record/calculations.rb')
-rw-r--r--activerecord/lib/active_record/calculations.rb8
1 files changed, 7 insertions, 1 deletions
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)