-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Interesting. The queries I'm generating get pretty nasty and there's something to be said for the symmetry offered by a key in the options and documentation, etc. I can probably unwind the :having stuff I've done and glue it all onto the :group clause if I'm one of the few people who care about it and use it, but it makes my OCD twitch a little. But I can always leave the :having hackery I've added to my query generation stuff tucked away in my lib/ to allay my cleanliness obsession.

I think this is a relatively low hanging add, but its pointless for me to toil away extracting in into a patch if nobody cares or wants the extra key.

On Aug 5, 2006, at 12:08 PM, Josh Susser wrote:


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

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.3 (Darwin)

iD8DBQFE1NU8qvuZB2zXNU0RAqJNAJwOdTBIeiwoTY3ENT27a8wkz/BJzwCg0D+n
OMV6NuOoxgjEB6yGwJUyuY4=
=ihXG
-----END PGP SIGNATURE-----
_______________________________________________
Rails-core mailing list
Rails-core@lists.rubyonrails.org
http://lists.rubyonrails.org/mailman/listinfo/rails-core

Reply via email to