diff options
-rw-r--r-- | activerecord/CHANGELOG | 2 | ||||
-rw-r--r-- | activerecord/lib/active_record/calculations.rb | 6 |
2 files changed, 7 insertions, 1 deletions
diff --git a/activerecord/CHANGELOG b/activerecord/CHANGELOG index 9540d6fc17..da08d14816 100644 --- a/activerecord/CHANGELOG +++ b/activerecord/CHANGELOG @@ -1,5 +1,7 @@ *SVN* +* When grouping, use the appropriate option key. [Marcel Molina Jr.] + * Only modify the sequence name in the FrontBase adapter if the FrontBase adapter is actually being used. [Marcel Molina Jr.] * Add support for FrontBase (http://www.frontbase.com/) with a new adapter thanks to the hard work of one Mike Laster. Closes #4093. [mlaster@metavillage.com] diff --git a/activerecord/lib/active_record/calculations.rb b/activerecord/lib/active_record/calculations.rb index 7a25bd4aa1..e16bf9e6d7 100644 --- a/activerecord/lib/active_record/calculations.rb +++ b/activerecord/lib/active_record/calculations.rb @@ -173,7 +173,11 @@ module ActiveRecord add_joins!(sql, options, scope) add_conditions!(sql, options[:conditions], scope) add_limited_ids_condition!(sql, options, join_dependency) if join_dependency && !using_limitable_reflections?(join_dependency.reflections) && ((scope && scope[:limit]) || options[:limit]) - sql << " GROUP BY #{options[:group_alias]} " if options[:group] + + if options[:group] + group_key = Base.connection.adapter_name == 'FrontBase' ? :group_alias : :group_field + sql << " GROUP BY #{options[group_key]} " + end if options[:group] && options[:having] # FrontBase requires identifiers in the HAVING clause and chokes on function calls |