From 796a43dead8ebf2fb9d28a25cb90e83c9baab4a0 Mon Sep 17 00:00:00 2001 From: Rick Olson Date: Tue, 14 Mar 2006 14:59:14 +0000 Subject: Allow ordering of calculated results and/or grouped fields in calculations [solo@gatelys.com] closes #4228 git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@3865 5ecf4fe2-1ee6-0310-87b1-e25e094e27de --- activerecord/lib/active_record/calculations.rb | 1 + 1 file changed, 1 insertion(+) (limited to 'activerecord/lib/active_record') diff --git a/activerecord/lib/active_record/calculations.rb b/activerecord/lib/active_record/calculations.rb index 8988ebf4e8..6c5ae3edca 100644 --- a/activerecord/lib/active_record/calculations.rb +++ b/activerecord/lib/active_record/calculations.rb @@ -151,6 +151,7 @@ module ActiveRecord add_conditions!(sql, options[:conditions]) sql << " GROUP BY #{options[:group_field]}" if options[:group] sql << " HAVING #{options[:having]}" if options[:group] && options[:having] + sql << " ORDER BY #{options[:order]}" if options[:order] sql.join end -- cgit v1.2.3