Forum: Ruby :having problem

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
7e011b375430d7c082a39bf146202ba6?d=identicon&s=25 Ganesh Kumar (ganesh_rljit)
on 2009-02-16 07:37
Hi I am using :having option in query it is  giving error like

"Unknown key(s): having"

plz reply me with solution

Advanced Thanks
Ganesh
31e038e4e9330f6c75ccfd1fca8010ee?d=identicon&s=25 Gregory Brown (Guest)
on 2009-02-16 08:04
(Received via mailing list)
On Mon, Feb 16, 2009 at 1:37 AM, Ganesh Kumar <gani_chinta@yahoo.com>
wrote:
> Hi I am using :having option in query it is  giving error like
>
> "Unknown key(s): having"

Sounds like :having is an unknown key.

-greg
8f6f95c4bd64d5f10dfddfdcd03c19d6?d=identicon&s=25 Rick Denatale (rdenatale)
on 2009-02-16 13:58
(Received via mailing list)
On Mon, Feb 16, 2009 at 1:37 AM, Ganesh Kumar <gani_chinta@yahoo.com>
wrote:

> Hi I am using :having option in query it is  giving error like
>
> "Unknown key(s): having"
>
> plz reply me with solution
>
>
First, off, I'm guessing that this is a question about ActiveRecord,
probably in the context of Rails. In general the rails group does better
fielding these kind of queries than ruby-lang which focuses on the ruby
language, and not so much on rails.

That said.

ActiveRecordBase#find does not have a :having option.   It's been
proposed,
but  never acted upon.  Instead you should add the HAVING clause to the
value of the :group option per the reply by Josh Susser in this thread:

http://www.ruby-forum.com/topic/76042

I think that this makes sense, since the HAVING clause must be used in
conjunction with  a GROUP BY clause in SQL

As far as I know, nothing came of making a plugin to add a having option
which was mentioned at the end of this 30 something month old thread.

--
Rick DeNatale

Blog: http://talklikeaduck.denhaven2.com/
Twitter: http://twitter.com/RickDeNatale
This topic is locked and can not be replied to.