1

所以我有一个包含多个输入的表单。例如:

<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>

我正在做的是克隆一个列表,当我单击克隆时,我希望以前选择的值在我的表单上显示为选中状态。状态的第一个输入完美地工作。状态是一个字符串。第二个,合作社,没有通过。当我在 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">

不确定一个如何工作而不是另一个

4

0 回答 0