accepts_nested_attributes_for and has_many :through relations.

Posted by antiarchitect on Stack Overflow See other posts from Stack Overflow or by antiarchitect
Published on 2010-05-12T03:26:52Z Indexed on 2010/05/12 3:34 UTC
Read the original article Hit count: 418

I want to make a simple examing application on RoR 2.3. The problem area is to make an exam_session in a one form with only one submit action. For the exam session there are selected some number of questions from the question pool in random order. For these questions there are selected some number of alternatives (to check is this a single answer question or multi answer question I use the number of correct alternatives: if only 1 - single, > 1 - multi. Radiobuttons or checkboxes in form to answer depends on it). I have models: Questions ---< Alternative and ExamSession. I think there must be has_many :through relations between ExamSession and Questions and has_many :through relation between the intermediate table (for example QuestionsExamSession) and Alternative to point what alternatives are answers of the student on this Question.

So the questions are:

  1. Is this scheme is too complicated and there is a way to do it simple and clear?
  2. Is there any way to organize models in such a way to make the form I want to work?

© Stack Overflow or respective owner

Related posts about ruby-on-rails

Related posts about has-many-through