Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

where clause in associated model #233

Closed
yawnt opened this issue Aug 1, 2012 · 6 comments
Closed

where clause in associated model #233

yawnt opened this issue Aug 1, 2012 · 6 comments

Comments

@yawnt
Copy link

yawnt commented Aug 1, 2012

Let's say i have a Link model that hasMany(Tag)

it'd be cool if i could find every Link where Tag.name is in ["one","two","three"]

i saw node-persist has something like that

if you have any idea on how i could implement that i'd be happy to do it myself and submit a pull request

@janmeier
Copy link
Member

janmeier commented Aug 9, 2012

This functionality is already implemented in #214.

Please clarify with a code example if everything does not work as expected ;-)

@gustavohenke
Copy link

@janmeier, what he asked has nothing to do with #214.
He wants to do, basically, this:

Link.all({ where : { 'tag.name' : ['one', 'two', 'three'] });

What would result in a SQL something like this:

SELECT * FROM link l
INNER JOIN tag t ON t.linkId = l.id
WHERE t.name IN ('one', 'two', 'three')

It's exactly the same thing I want right now ;D

@yawnt
Copy link
Author

yawnt commented Nov 7, 2012

yeah.. i ended up implementing my own orm (http://github.com/coderz/hater) which has it :P

@sdepold
Copy link
Member

sdepold commented Nov 8, 2012

so we can just copy and paste your stuff :D easy 😆

@mickhansen
Copy link
Contributor

I believe this is possible in the current master. Closing.

@mickhansen
Copy link
Contributor

More advanced stuff implemented in #1199

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants