【发布时间】:2019-01-18 04:15:02
【问题描述】:
我有数组任务[],其中包含表单中的项目
<%= check_box_tag "tasks[]", task.id %>
我在控制台中看到它们
Processing by TasksController#destroy as HTML
Parameters: {"utf8"=>"?", "authenticity_token"=>"qo6JqGn0a1Yck1j67taz7kEu/ENBrwLg0xs4HbmAehNq7yMVB3llJWYgZvRNrWKPrZqYJtZIaS89EIBFIyDZTA==", "tasks"=>["7", "8"], "commit"=>"Trash All Checked", "id"=>"delete_all"}
但不能删除,操作不起作用
def delete_all
Task.where(id: params[:id]).destroy_all
redirect_to action: "index"
end
【问题讨论】:
标签: ruby-on-rails arrays action checked