所以例如我有非restful命名路由:
get ':controller/:action/:juhu/:blabla', :as => "something"
从rake 路线我有以下几点:
Prefix Verb URI Pattern Controller#Action
something GET /:controller/:action/:juhu/:blabla(.:format) :controller#:action
//控制器
class TestsController < ApplicationController
def juhu_juhu
# Will try to render juhu_juhu.html.erb
end
end
// 看法
<%= link_to "Get back", something_path %>
我得到错误:
No route matches {:juhu=>"1", :blabla=>"neta", :controller=>"tests", :action=>"juhu_juhu"} missing required keys: [:id]
那么这个“缺少必需的键:[:id]”呢?
所以我假设每条宁静的路线都必须有:id按照惯例(我是对的吗?),但为什么非宁静的路线也必须有:id(字面意思是:id),或者我在这里做错了什么?