So, why don't u try? )) It seems to be 5 mins of code. "Can I leave AnswerId or QuestionId field blank when creating a comment record? " - yes, but you will get "05:11:38.235 [error] Error parsing Boss record id: error:function_clause", but it is not critical. You can stay with 1 vote model, just add VoteId to all models.
On Friday, May 9, 2014 9:04:32 AM UTC+4, Neil Pahl wrote: > > 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/8f908f60-4d20-43f9-adb2-f89edc853442%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
