Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to display inputs of for associated object with object is created on new form?
    primarykey
    data
    text
    <p>I'm not sure the topic will have the right meaning what I want, but I don't know how to explain. I'm building online examination app. To easy for explain problem, I focus to 6 tables:</p> <ol> <li>Courses: <strong><code>has_many</code></strong> topics</li> <li>Topics: <strong><code>belongs_to</code></strong> course</li> <li>Questions: <strong><code>belongs_to</code></strong> topic, <strong><code>has_many</code></strong> general_exams, <strong>through:</strong> :general_questions</li> <li>GeneralExams: <strong><code>has_many</code></strong> questions, <strong><code>through:</code></strong> general_questions, <strong><code>belongs_to</code></strong> user, <strong><code>belongs_to</code></strong> course, <strong><code>has_many</code></strong> exam</li> <li><p>GeneralQuestions: <strong><code>belongs_to</code></strong> question, <strong><code>belongs_to</code></strong> general_exam</p></li> <li><p>Exam: <strong><code>belongs_to</code></strong> general exam, <strong><code>belongs_to</code></strong> user</p></li> </ol> <p>This is columns in table GeneralExam: </p> <pre><code>name,description,semester,number_question,duration,used, user_id, course_id </code></pre> <p>What I want to do now, is create a general exam, and can specific a number of questions for each topic of course. Example, I have a <strong>course named</strong> "Database" has 3 topics: A,B,C. Now I want to create general exam for <strong>"Database" course</strong>. I want to specific when create general exam:</p> <ul> <li>5 question for topic A</li> <li>6 question for topic B</li> <li>7 question for topic C</li> </ul> <p>These questions I get random from these topic. I have build a form for create general exam, but I don't know how to get topics of course on the form, and make a field for input number question for each topic. So is there some way to list topics on new form of general exam and each topic will have a field to type in number question will be got random for that topic? Or I need to create a new table to store that information?</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload