Created
April 12, 2011 16:33
-
-
Save tenderlove/915852 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# totally contrived example | |
User.select(Account[:name]).join(:accounts).where(User[:id].in(Group.where(:name => 'foo'))) |
Also, I think I'm stealing your "putting lipstick on a pig" line for Squeel. It just fits.
lol! Please take it! :-D
@tenderlove: see activerecord-hackery/squeel@f33784217e3bbb030c21
FWIW: evaluate was a typical case of overthinking -- I didn't like stomping on Kernel#eval, even though there's no reason to care in this case. :)
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Your example (self-referencing associations) is precisely the reason I need to maintaining the context, and can't stomach the Person[:name] solution. :( We need to "mount" the constraints, for lack of a better term, on the proper table alias. Squeel does that right now via mapping the hash keys (or keypaths in the case of children.children.children) against the corresponding joins in the JoinDependency, then grabbing the JoinAssociation's table. Hope that makes sense.
See my post in the other thread for the pull request for sample queries and actual output.