I think Many to Many will help you.
sort of
-------- ----------------- ------------ - tags - <-------> - products_tags - <-------> - products - -------- ----------------- ------------
change
The Many to Many approach is more normalized, but I think that it is the most difficult to implement, since in this case it is based on associations to get all the tags for this "product". Benefits:
- fully normalized
- DRY : because if you need to change the tag name, you can do it and you will see change everywhere
- and etc.
another approach is to save all tags in one field, separated by something (for example, a comma). Here you have the speed in terms of receiving tags. you just need to split the tags into this separator, and that is it. Saving tags is easier. but I donβt like this approach, because if you need to update the template, you need to go through the articles, split, update and then save.
source share