Slash in URL Parameter

Has anyone come across a problem whereby a parameter in the urn, :name, for example, contains a slash - either escaped (%2F) or not (/) that causes the route to be incorrectly recognised?

I have the following route:

"climbs/:id/:name/:action", :action => 'show', :id => /(\d*)/

If the :name part contains a slash, the route is not followed. If anyone else has seen this, I'd love to know how you sorted it!



Hi Alex,

Thanks for replying - it's a bit of a bind, this one!

The name part is specified by the users, so it's not possible to guarantee that it will always or never contain a slash. I was hoping that %2F would be interpreted by routing as being part of a parameter, whereas a literal / would be interpreted as a separator.

I'm sure this has been solved by someone somewhere - how would a rails- based blog cope with a post that contains a slash in the title, for example?

Thanks again.

So the solution would be to create a slug column in any table that allows data from a column that contains slashes or periods (same problem with periods in rails >= 1.2) - the slug column containing an appropriately escaped value of the column to be referenced in the URL.

I'll give this a try.

Thanks for your help!