Well, then use a join.
```
Competition.joins(:tags).where(tags: { id: @idea.tags })
```
This is off the top of my head, I don't remember if there's a nicer way, but this will produce the desired query.