0

我需要帮助。我在数组测验选项中有表单标签按钮。当值答案为 1 时,我需要检查真实答案。

<%= radio_button_tag('quiz_en_option[is_answer][]',"1",quiz_option_en.is_answer) %>True 
<!-- <input id="quiz_en_option_is_answer__1" type="radio" value="1" name="quiz_en_option[is_answer][]" checked="checked"> -->

请帮帮我

4

2 回答 2

0

radio_button_tag(名称,值,选中 = false,选项 = {})

# if quiz_option_en.is_answer is 1 it will get checked else unchecked 
<%= radio_button_tag('quiz_en_option[is_answer][]',"1",quiz_option_en.is_answer.eql?(1) %>True 
于 2013-02-21T05:18:47.480 回答
0

我现在得到了真正的答案,名字不应该是数组。

  <%= radio_button_tag('quiz_en_option[is_answer]', i.to_s, quiz_option_en.is_answer, id: "answer_" + i.to_s, class: "en-answer-radio" ) %>True
于 2013-02-22T09:56:00.667 回答