I'm thinking about a "Stack Overflow" like scenario. Say I have the following models:
question
answer
comment
vote
appuser (user is reserved)
I would like questions and answers to have comments, and all three of those to have votes.
so, should my model for a comment look something like this?:
-module(comment, [Id, CommentText, AnswerId, QuestionId, AppuserId]).
-belongs_to(answer).
-belongs_to(question).
-belongs_to(appuser).
-compile(export_all).
However, I only want the Comment to belong to one of answer OR question. Can I leave AnswerId or QuestionId field blank when creating a comment record?
Or, do I have to have less abstraction and create two more question/answer specific models like:
-module(questioncomment, [Id, CommentText, QuestionId, AppuserId]).
-belongs_to(question).
-belongs_to(appuser).
-compile(export_all).
and
-module(answercomment, [Id, CommentText, AnswerId, AppuserId]).
-belongs_to(answer).
-belongs_to(appuser).
-compile(export_all).
Similar case with votes, expect I want each of question, answer, and comment to be able to get a vote... 1 vote models which can used for all 3? or 3 vote models for each q/a/comment.
Thanks in advance,