Topic: how to set one field true remaining false at time using boolean
I have 2 models
1. Question
2.Answer
in model mappings like:
class Question
has_many: answers
end
class Answer
belongs_to: answer
end
how to check correct answer in question controller?
EX:
ID 1: QUESTION : 5+5?
ANSWERS: A.5
B.8
C.9
D.10
Question Table:
id Title
1 5+5?
Answer Table:
+----+--------+------------+-------------+---------------------+---------------------+
| answer | is_correct | question_id | created_at | updated_at
+----+--------+------------+-------------+---------------------+---------------------+
5 0 1
8 0 1
9 0 1
10 1 1
DROPDOWN : D if click D option from dropdown to print correct answer in index.
how will i determine which drop down is selected and how will i get
the value of the drop down that is selected?
In question controller i can handle 2 models Question and Answer
Plese help me!!!
please help me how to make code in controller !!!! i am new to rails!!!!
Thanks in advance!!!
Last edited by naresh0505 (2013-02-21 00:28:40)