On Aug 4, 2006, at 11:19 PM, Blake Watters wrote:
I have recently needed support for having clauses for some advanced
find queries in my application. I've implemented this in a mixin
that implements a new set of finders and query constructors that
mirror the core Active Record, except for the additional support
for :having as an argument. This has reached stability and now
works with eager loading and scopings, so I'd like to extract it
from my application as a patch against Active Record core.
I'm using HAVING just fine already. Just append the HAVING clause to
the end of the :group option.
find(:all, :readonly => false,
:select => "articles.*",
:joins => "INNER JOIN taggings t ON articles.id = t.article_id",
:conditions => ["t.tag_id IN (?)", tag_list], :order => order,
:group => "articles.id HAVING COUNT(articles.id) = #
{tag_list.size}")
Is there something you're using HAVING for that needs more
flexibility than that?
--
Josh Susser
http://blog.hasmanythrough.com
_______________________________________________
Rails-core mailing list
Rails-core@lists.rubyonrails.org
http://lists.rubyonrails.org/mailman/listinfo/rails-core