Hi All,
I have two tables, photos and tags, with a standard photos_tags link table.
My models show Photos HABTM Tags, and I can update both fine with the links updating too.
My question is: say I now want to find all Photos tagged with both "Sunset" and "Ocean" - how do I go about that?
I've tried doing an inner join as per Nate's Bakery post and I can now find all photos tagged with either OR both, but I want just those with both tags (e.g. an "AND" find, if that's the correct phrase). Currently adding more tags gives me more results - I want less results as more tags are added!
Alternatively, if there isn't a nice Cakey way, how would you do it? Multiple searches and then compare the arrays? Seems kinda wasteful though...
TIA.