我在RoR 5.1.4上有一条路线:
get '/search(/:profile_type(/:tag(/:country)))', to: "search#index", as: "search"
我希望如此:
[3] pry(main)> app.search_path(country: 'test')
=> "/search?country=test"
但它是:
[3] pry(main)> app.search_path(country: 'test')
=> "/search"
丢失'country'参数。我在这里错过了什么吗?如果它是一个巨大的错误,我希望我错了
[4] pry(main)> app.search_path(tag: 'whatever', country: 'test')
=> "/search"
[5] pry(main)> app.search_path(test: 'test')
=> "/search?test=test"
[6] pry(main)> app.search_path(profile_type: 'test1', tag: 'test2', country: 'test3')
=> "/search/test1/test2/test3"
[7] pry(main)> app.search_path(profile_type: 'test1', tag: 'test2', country: 'test3', test: 'test')
=> "/search/test1/test2/test3?test=test"