User A joined the group DBA
The table responsible for users x groups is "Following" table.
user_id group_id 1 1 1 2 2 1
And in my app I have a table Comments. the foreign key of it is polimorphic, because comments can happen inside posts, photos, etc..
text parent_type parent_id "cool" Post 1 "nice pic" Photo 2 "welcome!" Following 3
It is a good schema? The following table has_many
comments?
And a more complex one would be: "How to comment on a set of people joining?"
Best Answer
I think if you want to be able to comment on someone joining a group, then "join a group" must be an entity that can be referenced by other records. You might want to have another "parent_type" called "event" and one of the event types would be "joined a group". That would let you reference it from your comments table.