"The page you were looking for doesn't exist." 编辑表单
"The page you were looking for doesn't exist." 编辑表单
我有以下的route:
namespace :dashboard do get '/courses/:id/edit' => 'courses#edit', :as => :edit_course put 'courses/:id/update' => 'courses#update' end
和这个form:
= form_tag dashboard_edit_course_url( @course), :method => 'post', :multipart => true do ...
这个form的action是:
"The page you were looking for doesn't exist." 这个问题的出现原因是提交的表单中的第一个参数指定的页面不存在。在给定的链接中,指定了表单提交的目标页面的参数(update),但是该页面不存在。
解决方法是更改表单提交的目标页面的参数,确保指定的页面存在。根据链接中提供的文档,可以查看可用的参数选项,并选择一个存在的页面作为目标页面。
以下是解决方法的示例代码:
<%= form_tag({:action => "update", :controller => "pages"}, method: "post") do %> <% end %>
在这个示例中,我们将表单提交的目标页面设置为 "update" 动作在 "pages" 控制器中。请根据实际情况修改参数,确保指定的页面存在。