我有这样的看法:
<% if actions.include? "delete" %>
<%= link_to 'Usuń', asset_path(asset), :method => :delete, :data => { :confirm => "Want to delete it?" }, :role => "link" %>
<% end %>
这在资产控制器中:
def destroy
@asset = current_user.assets.find(params[:id])
@asset.destroy
redirect_to assets_path
end
问题是,当视图中的操作是“删除”时,为什么它“使用”销毁方法?