Rails.application.routes.draw do
#get 'welcome/index'
#get 'welcome/sample'
match ':controller(/:action(/:id))', : via => :get
# For details on the DSL available within this file, see http://guides.rubyonrails.org/routing.html
root 'welcome#index'
end
匹配控制器部分不允许我转到路线welcome / sample或welcome / index
答案 0 :(得分:1)
您的代码适合我,但: via
应为:via
另外,我建议您使用get
代替match
。见rails github guide(谢谢@ABPrime)。
get ':controller(/:action(/:id))'