In my ruby application I have created a backend for managing quizzes. It consists of a Quiz, QuizQuestion,and QuizChoice Models. The controller is could quizzes. It works great!
For the frontend of the application (where the user takes the quiz) I need to track the score on a quiz, which quiz they took, the questions they got right, and the questions they got wrong.
I am having a hard time coming up with the models needed and if I can have a restful controller for this type of application. Do you have any ideas?
My idea for the model is:
- QuizResult
- quiz_id:integer
- user_id:integer
- score:integer
- QuizQuestionResult
- quiz_question_id:integer
- correct:boolean
But the part where I get stuck is the controller. I want to make it restful, but I am not sure where to begin.
Do a QuizResponse model which has_many :quiz_question_results. Then do quiz_response/new for taking the quiz?