使用
:remote =>trueAjax事件创建表单时,该事件绑定到表单的“提交”按钮。您必须使用javascript触发该事件。这是我用来完成类似操作的一些代码:
<%= form_for [item.list, item], :remote => true, :html => { :'data-type' => 'json', :id => 'change-completed-form' } do |f| %> <td><%= f.label :name, item.name %></td> <td><%= f.check_box :completed, :onClick => "this.form.submit_button.click();" %></td> <%= f.submit :id => 'submit_button', :style => 'display: none;' %><% end %>


