在Rails 5.0.5上,以下路由定义有效
get 'terms_of_use', to: 'pages#terms_of_use', path: "terms-of-use"
在5.1.3上,启动Rails服务器时出现以下错误
/home/dev/.rvm/gems/ruby-2.3.3/gems/actionpack-5.1.3/lib/action_dispatch/routing/mapper.rb:1852:in `block in map_match': Ambigous route definition. Both :path and the route path where specified as strings. (ArgumentError)
我是不是在Rails 5.1.3中错误地使用了path:
,还是这是一个Rails错误?
错误消息中“歧义”的错误拼写和"where“的错误用法并不能让我对Rails在这方面的正确性充满信心……
发布于 2017-08-19 13:31:27
尝试以下操作之一:
get :terms_of_use, to: 'pages#terms_of_use', path: 'terms-of-use'
或
get 'terms-of-use', to: :terms_of_use, controller: 'pages'
https://stackoverflow.com/questions/45767364
复制相似问题