2023-08-10 05:01PM
参考:https://stackoverflow.com/questions/25659488/using-link-to-with-delete-action-in-rails
Before Rails 7(可以这样使用)
<%= link_to 'Delete', manage_user_path(user),
method: :delete, data: {confirm: "Are you sure?"} %>
Rails 7 (with Turbo, out of the box)
<%= link_to 'Delete', manage_user_path(user),
data: {turbo_method: :delete, turbo_confirm: 'Are you sure?'} %>
eg: 我的是rails 4所以使用第一种
登录
请登录后再发表评论。
评论列表:
目前还没有人发表评论