[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

:having problem

Ganesh Kumar

2/16/2009 6:37:00 AM

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
--
Posted via http://www.ruby-....

2 Answers

Gregory Brown

2/16/2009 7:04:00 AM

0

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

--
Technical Blaag at: http://blog.majesticseacr...
Non-tech stuff at: http://metametta.bl...
"Ruby Best Practices" Book now in O'Reilly Roughcuts:
http://rubybestpra...

Rick DeNatale

2/16/2009 12:53:00 PM

0

[Note: parts of this message were removed to make it a legal post.]

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/t...

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.denh...
Twitter: http://twitter.com/Ri...