When grouping, use the appropriate option key. [Marcel Molina Jr.]
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@4297 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
This commit is contained in:
parent
2ec1527c47
commit
0dc53a8f6f
|
@ -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]
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue