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
ruby ruby-on-rails routes


source to share


No one has answered this question yet

See similar questions:

1
Rails RSpec request spec doesn't work because unexpected% 2F was added to redirect response

or similar:

1339
How can I rename a database column in Ruby on Rails migrations?
1023
How do I get the current absolute url in Ruby on Rails?
941
Understanding Rails Authentication ID
876
Brief explanation of nil v. Empty v. Blank in Ruby on Rails
592
How to remove columns using Rails migrations
574
How can I "nicely" format the JSON output in Ruby on Rails?
470
How to redirect to 404 in Rails?
437
Cancel scaffolding in Rails
368
No routes match "/ users / sign_out" devise rails 3
0
rails url as breading



All Articles
Loading...
X
Show
Funny
Dev
Pics