In Rails 4, I have a project in which I've set up three models with the following many-to-many relationships:
- An Item
- has_and_belongs_to_many categories
- has_and_belongs_to_many tags
- A Category
- has_and_belongs_to_many items
- A Tag
- has_and_belongs_to_many items
And while it's easy to select an Item and automatically get all associated categories and tags, there are some situations in which I'd want to select items AND their associated categories, but NOT their tags. In these cases, I'd like to avoid doing extra database joins against the Tags table and ItemsTags join table. Can anyone help me with the correct find syntax to only join Items to categories? (Side note: I'm also planning on adding 10 additional many-to-many relationships between items and other models, but I'm just simplifying the scenario for this question. In the end, I'm trying to avoid doing a join with an excessive number of tables whenever I can.)
Thanks!