标签: ruby-on-rails ruby-on-rails-3 ruby-on-rails-4
我有两条路线:
get "shopping", to: "bar#show" get "shopping/*relative_path", to: "bar#show"
我如何加入他们,到一条路线?
当我只是省略get "shopping", to: "bar#show"时,转到localhost:3000/shopping的用户不会被重定向到控制器bar#show
get "shopping", to: "bar#show"
localhost:3000/shopping
bar#show
感谢
答案 0 :(得分:2)
您可以将第二部分包装成括号:
get "shopping(/*relative_path)", to: "bar#show"
docs中此行为的说明。