I have a Rails application that includes tables for surveys and (survey) questions.
- A survey has_many questions
- A question belongs_to a survey
The surveys are inherently teacher surveys. Now we are introducing student surveys, which are meaningfully different from teacher surveys, with different types of information that we need to store about them, such that they seem to each warrant their own table/model, so I'm thinking we want separate tables for teacher_surveys and student_surveys.
However, the questions are really pretty much the same. Includes things like the question text, type of question (text, checkbox, dropdown), etc. So it seems like questions should remain a single table.
How do I best model this data?
- Should the questions table have a teacher_survey_id and a student_survey_id where each is optional but one of the two of them is required?
- Should I have join tables for questions_teacher_surveys and questions_student_surveys?
- Something else?