instance method
having
Ruby on Rails 4.1.16
Since v3.0.20Signature
having(opts, *rest)
Allows to specify a HAVING clause. Note that you can’t use HAVING without also specifying a GROUP clause.
Order.having('SUM(price) > 30').group('user_id')
Parameters
-
optsreq -
restrest
Source
# File activerecord/lib/active_record/relation/query_methods.rb, line 593
def having(opts, *rest)
opts.blank? ? self : spawn.having!(opts, *rest)
end
Defined in activerecord/lib/active_record/relation/query_methods.rb line 593
· View on GitHub
· Improve this page
· Find usages on GitHub
Defined in ActiveRecord::QueryMethods