After rails 4 upgrade% 2F Held at url

We are currently upgrading to 4 rails (in particular 4.2.1). In our Rails 3 release, we have an SEO friendly URL that is generated by overriding the to_param method.

def to_param
[
  (city||"all").to_url.capitalize,
  (property_type||"apartment").to_url,
  [
    id,
    (self.title(:en) || "No title").to_url.tr("`","")
  ].join("-")
].join("/") 
end

      

And on Rails 3 it used to generate the following url:

city/type/id-title

      

But now it begets

city%2Ftype%2Fid-title

      

We cannot find an answer to this question. It even causes a collision with another route. Thanks in advance.

UPDATE: I am including routes to make them clearer. I didn't change anything, it worked fine before updating.

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

      

+3


source to share





All Articles