Ruby on rails 在URL上转义rails 4升级%2F之后

Ruby on rails 在URL上转义rails 4升级%2F之后,ruby-on-rails,ruby,routes,Ruby On Rails,Ruby,Routes,我们目前正在升级到rails 4(特别是4.2.1)。在我们的Rails 3版本中,我们有一个SEO友好的URL,它是通过覆盖to_param方法生成的 在Rails 3上,它用于生成以下URL: city/type/id-title 但现在它正在生成 city%2Ftype%2Fid-title 我们似乎找不到答案。它甚至造成了与另一条路线的碰撞。提前谢谢 更新: 我加入了路线,让它更清楚。我没有在那里更改任何内容,在升级之前它运行良好 scope "rentals" do get "/"

我们目前正在升级到rails 4(特别是4.2.1)。在我们的Rails 3版本中,我们有一个SEO友好的URL,它是通过覆盖to_param方法生成的

在Rails 3上,它用于生成以下URL:

city/type/id-title
但现在它正在生成

city%2Ftype%2Fid-title
我们似乎找不到答案。它甚至造成了与另一条路线的碰撞。提前谢谢

更新: 我加入了路线,让它更清楚。我没有在那里更改任何内容,在升级之前它运行良好

scope "rentals" do
get "/", to: "frontpage#index"
get "/new", to: "properties#new", as: "new_property"
get "/(:destination)/(:type)", to: "searches#show", as: "search"

resources :properties, path: "", constraints: { id: /[a-zA-Z0-9\-\.][\/]+/}, except: [:index, :new] do

您究竟在哪里使用
来设置参数
方法?当您试图使用rails的view helper生成show/edit链接时,它将被
url\u for
方法调用。请尝试这样的解决方案:我并没有显式地将其称为@Surya,只是调用property\u path之类的帮助程序。@teoreda在我看来,该解决方案就像猴子补丁一样。没有其他方法可以不借助这个来维护我的旧URL吗?
scope "rentals" do
get "/", to: "frontpage#index"
get "/new", to: "properties#new", as: "new_property"
get "/(:destination)/(:type)", to: "searches#show", as: "search"

resources :properties, path: "", constraints: { id: /[a-zA-Z0-9\-\.][\/]+/}, except: [:index, :new] do