Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class Exam has_many :questions
- has_and_belongs_to_many :users
- class Question has_many :answers
- has_many :user_answers
- belongs_to :exam
- class Answer belongs_to :question
- class UserAnswer belongs_to :question
- belongs_to :user
- class User has_and_belongs_to_many :exams
- has_many :user_answes
- answer = Answer.find(params[:id])
- user_answer = UserAnswer.create(answer_id: answer.id, user_id: user.id, question_id: answer.question.id)
Add Comment
Please, Sign In to add comment