I want to create a simple application with three types of objects:
- Article (1st day at RoR, why PHP is still cool, RoR vs PHP)
- Author (Bob, Steve, Jen)
- Tags (RoR, PHP)
The author writes an article and creates the appropriate tags.
So:
author has many articles; article belongs to author
But what about tags? I want tags in both articles and authors.
I can imagine that:
author has many tags; article has many tags
But what about an ad in a tag model?
tag belongs to authors; tag belongs to articles
Will two people interfere with each other?
I am afraid that the tag will require both an author and an article. and in the case when he has both types of parents, deleting one of them will delete the tag and the other parent due to foreign key restrictions in the database.
Thanks in advance!
source share