现在一直在盯着这个问题.这是我在尝试查看页面时遇到的错误.
No route matches {:action=>"confirm", :controller=>"locations"}
Run Code Online (Sandbox Code Playgroud)
这就是我在视图中所拥有的.
<%= form_for(@location, :url => { :action => :confirm }) do |f| %>
<% end %>
Run Code Online (Sandbox Code Playgroud)
我认为我的路线文件设置正确.
Finder::Application.routes.draw do
resources :locations do
member do
post :confirm
end
end
root :to => 'locations/index'
end
Run Code Online (Sandbox Code Playgroud)
有任何想法吗?
更新:
跑rake路线,得到我认为正确的.
confirm_location POST /locations/:id/confirm(.:format) {:action=>"confirm", :controller=>"locations"}
Run Code Online (Sandbox Code Playgroud)