TLDR:
questions_question_set_id
次の人がこのようなことをしようとしている場合の詳細:
あなたがやろうとしていることに基づいて、私はaQuestionが複数に属することができQuestionSet、anAnswerは特定のQuestion内に固有であると仮定しますQuestionSet(私には論理的に見えるものとは対照的に、anはどちらAnswerに属しているQuestionかに関係なくQuestionSet入った)。
モデル
Question
QuestionSet
Answer
QuestionsQuestionsSet
テーブル
questions
id
question_sets
id
answers
id
questions_question_set_id
questions_question_sets
id
question_id
question_set_id
アソシエーション
Question hasAndBelongsToMany QuestionSet
QuestionSet hasAndBelongsToMany Questions
Answer belongsTo QuestionsQuestionSet
QuestionsQuestionSet hasMany Answer
田畑