的link_to刪除重定向展現行動,而不是去破壞鐵軌行動3.1.1錯誤:刪除的link_to重定向到顯示行動,而不是去破壞鐵軌行動3.1.1
這裏是我的代碼
查看: -
:delete, :confirm => "Are you sure..!", :alt => "Delete", :title => "Delete" %>
控制器: -
def destroy @industry = Industry.find(params[:id]) if @industry.destroy flash[:notice] = "Successfully deleted industry with name #{@industry.name}" else flash[:error] = "Error Occurred while deleting industry. Please try again." end redirect_to industries_path
end
給route.rb的代碼和代碼的link_to。 –
這裏的意見查看次數 <%= link_to「Delete」,industry_path(industry.id),:method =>:delete,:confirm =>「Are you sure ..!」,:alt =>「Delete」 ,:title =>「刪除」%> – devudilip
請給出路由信息。您可以使用(從終端)'$ CONTROLLER = controller_name rake routes'來列出路由。 –