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,

-- 
You received this message because you are subscribed to the Google Groups 
"ChicagoBoss" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
Visit this group at http://groups.google.com/group/chicagoboss.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/chicagoboss/b95bdfbf-2fef-4756-9f86-4a020c67d912%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to