我在路线中有这个:
get 'entities/:var1/:var2' => 'entities#show'
但是这个:
entities_path(var1: "fdsfds", var2: "fdsfdsfdsfds")
生成一个网址?和&amp ;.这是为什么?为什么不用" /"?
答案 0 :(得分:1)
在routes.rb
get 'entities/:var1/:var2', to: 'entities#show', as: 'custom_entities'
并用
调用它custom_entities_path("fdsfds", "fdsfdsfdsfds")
现在生成
entities/fdsfds/fdsfdsfdsfds
现在你会得到
params[:var1] = "fdsfds"
# and
params[:var1] = "fdsfdsfdsfds"