I have two tables Stores and Categories
Relationship of these tables are: Many to Many
Store can have many categories
Category can also have many stores
Now in the stores table I have a store_name and category_id attributes
that links the category table to the store table via its Category_ID
The Category table only has category_id and category_description
I want to be able to perform a search on Categories index.html.erb page
to find stores which fall into that particular category.
Therefore I need the search function to look into the stores table and
match the category_id to the category_id in categories table, and return
the store names with those categories.
I have tried some example but they donâ€™t seem to be working. Can someone