I have a model, resource, which has_many categories:
has_many :category_resources, :dependent => :destroy has_many :categories, :through => :category_resources
I have it setup to filter on categories, for a list view: records = Resource.includes(:categories).where("category_resources.category_id" => categories)
Can you explain in words what you are trying to achieve with the query above please.
But I want it to still show all categories for a particular resource the listing, rather than just what was searched on.
eg, a resource, apple, has the categories, Food, Fruit, and Red.
If you select the resource Food, it should show: Name: Apple Categories: [Food, Fruit, Red]
Instead, I'm just getting: Name: Apple Categories: [Food]
If you have a Resource in resource, then resource.categories should always show you all the categories.
Colin