I have a Production Model with has_and_belongs_to_many relation on Tags.
I have an array of tag_ids = ['tag_one', 'tag_two'] and I want to find Productions who have those two tags or more.
Example : Production with tags ['tag_one', 'tag_two', 'tag_three'] would be return but a production with tags ['tag_one', 'tag_three'] wouldn't.
What I have tried so far :
Production.includes(:tags).where(tags: { id: ['tag_one','tag_two'] })
This request is not inclusive, it's returning production who have tag_one OR tag_two
Production.includes(:tags).where(tags: { id: ['tag_one'] }).where(tags: { id: ['tag_two'] })
This one is returning an empty array, i guess it's looking for a tag who has both ids which is impossible.
If you guys have any idea on how i can solve this it would be awesome
Thanks