We have three types of entity, each with their own table:
table:A(a_id), table:B(b_id), table:C(c_id)
Each of these entities can have any number of email addresses and linked Twitter accounts.
What is the best way to relate these tables where the foreign key could be that of table A, B or C?
I considered this:
Where belongs_to_type would be A, B or C and belongs_to_id would be the respective foreign key.
So if A(1) has an email address, that entry would in the EmailAddresses table would look like EmailAddresses(A,1).