This project is archived and is in readonly mode.

#2122 ✓resolved
Andrew Bloom

Routing with a blank path_prefix causes a bad url to generate

Reported by Andrew Bloom | March 3rd, 2009 @ 10:22 PM | in 2.x

edit Long complex description has been moved to my blog: http://www.somethingunimportant.... I have now updated this ticket to walk you through a simple example to reproduce this bug.

> rails bug

> cd bug

Edit routes.rb to include:


  map.connect "/applicants/:id", :controller => "applicants", :action => "show", :path_prefix => ""

> rake routes

(in /Users/abloom/Sites/bug)

//applicants/:id {:controller=>"applicants", :action=>"show"}

Edit routes.rb to include:


  map.connect "/applicants/:id", :controller => "applicants", :action => "show", :path_prefix => nil

> rake routes

(in /Users/abloom/Sites/bug)

/applicants/:id {:controller=>"applicants", :action=>"show"}

Notice how with the path_prefix set to an empty string the route builder generates an extra slash, but with it set to nil the path looks normal.

Comments and changes to this ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »

<h2 style="font-size: 14px">Tickets have moved to Github</h2>

The new ticket tracker is available at <a href="https://github.com/rails/rails/issues">https://github.com/rails/rails/issues</a>

Attachments

Referenced by

Pages