所以我有一个包含多个输入的表单。例如:
<div class="grid_12">
<%= f.input :status, as: :radio_buttons, collection: [ 'available', 'pending', 'rented','coming soon','off-market'], checked: @base_address.status %>
<%= f.input :coop, as: :radio_buttons, collection: ['Cooperate with brokers','Keep in-house'], checked: @base_address.coop %>
</div>
我正在做的是克隆列表,我希望在单击克隆时,我之前选择的值在我的表单上显示为已选中。状态的第一个输入完美。 status是一个字符串。第二个,合作社,没有通过。当我用chrome进行检查时,我得到了第一个:
<input checked="checked" class="radio_buttons required" id="address_status_off-market" name="address[status]" required="required" type="radio" value="off-market">
但这是第二次:
<input class="radio_buttons required" id="address_coop_cooperate_with_brokers" name="address[coop]" required="required" type="radio" value="Cooperate with brokers">
<input class="radio_buttons required" id="address_coop_keep_in-house" name="address[coop]" required="required" type="radio" value="Keep in-house">
不确定一个人如何工作而不是另一个