Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Post.joins(:tags).where(:tags => { :id => [tag_ids] } )
- GROUP BY posts.id
- HAVING count(tags.name) = 2
- Post.joins(:tags).select('posts.id').where(:tags => { :id => [tag_ids] }
- ).having("count(tags.name) = ?", tag_ids.count).group('posts.id')
Add Comment
Please, Sign In to add comment