Rails4 gem'bootstrap-editable-rails'类型=选择不工作

时间:2015-11-17 21:27:19

标签: ruby-on-rails

我在Rails3中成功使用了gem'bootstrap-editable-rails'。并且,它在Rails4中适用于'type = text'。

但是,我无法让'type = select'工作。

附件视图:

<td>
  <a href="#" class="xeditable" data-emptytext="Type" data-type="select" data-pk="1" data-resource="accessories" data-source="/accessorytypes" data-name="accessorytype_id" data-url="/accessories/<%= accessory.id %>" data-original-title="Select Type">
    <%= accessory.accessorytype.name if accessory.accessorytype_id != nil %>
  </a>
</td>

Javascript(咖啡):

  $(".xeditable").editable
    placement: 'bottom'

错误:

ActionController::ParameterMissing at /accessories/5
====================================================

> param is missing or the value is empty: accessory

app/controllers/accessories_controller.rb, line 88

第88行(强参数):

      params.require(:accessory).permit(:user_id, :manufacturer,:manufacture_year, :model, :accessorytype_id, :description, :sold, :count, :bow_id, :note, :sold_id, :archive)

1 个答案:

答案 0 :(得分:0)

我不得不改变:

From: data-resource="accessories"
To:   data-resource="accessory"