Module: ActiveRecord::Extensions::FinderOptions::HavingOptionBackCompatibility::ClassMethods
- Defined in:
- lib/ar-extensions/finder_options.rb
Overview
:nodoc:
Instance Method Summary collapse
-
#add_group!(sql, group_options, scope = :auto) ⇒ Object
:nodoc:.
-
#add_group_with_having!(sql, group, having, scope = :auto) ⇒ Object
add_group! in version 2.3 adds having already copy that implementation.
-
#options_with_group(options) ⇒ Object
:nodoc:.
Instance Method Details
#add_group!(sql, group_options, scope = :auto) ⇒ Object
:nodoc:
256 257 258 259 260 261 262 263 |
# File 'lib/ar-extensions/finder_options.rb', line 256 def add_group!(sql, , scope = :auto)#:nodoc: group, having = if .is_a?(Hash) && .has_key?(:group) [[:group] , [:having]] else [, nil] end add_group_with_having!(sql, group, having, scope) end |
#add_group_with_having!(sql, group, having, scope = :auto) ⇒ Object
add_group! in version 2.3 adds having already copy that implementation
243 244 245 246 247 248 249 250 251 252 253 254 |
# File 'lib/ar-extensions/finder_options.rb', line 243 def add_group_with_having!(sql, group, having, scope =:auto)#:nodoc: if group sql << " GROUP BY #{group}" sql << " HAVING #{sanitize_sql(having)}" if having else scope = scope(:find) if :auto == scope if scope && (scoped_group = scope[:group]) sql << " GROUP BY #{scoped_group}" sql << " HAVING #{sanitize_sql(scope[:having])}" if scope[:having] end end end |
#options_with_group(options) ⇒ Object
:nodoc:
265 266 267 268 269 270 271 |
# File 'lib/ar-extensions/finder_options.rb', line 265 def ()#:nodoc: if [:group] .merge(:group => {:group => [:group], :having => [:having]}) else end end |