This project is archived and is in readonly mode.
url_for doesn't accept dot characters
Reported by Nando Vieira | April 20th, 2010 @ 02:26 PM
When I have a route like
get '/:page' => "pages#show", :constraints => {:page => /.+/}, :as => :page
Rails raises an error if I try to use a route like
<%= link_to "Sample", page_path("sample.pdf") %>
The error:
ActionController::RoutingError in Pages#index
No route matches {:controller=>"pages", :constraints=>{:page=>/.+/}, :page=>"sample.pdf", :action=>"show"}
On line #2 of app/views/pages/index.html.erb
1: <p>
2: <%= link_to "Sample", page_path("sample.pdf") %>
3: </p>
app/views/pages/index.html.erb:2:in `_render_template__553364074_2179637920_0'
I made it work by replacing dots for its escaped equivalent:
<%= link_to "Sample", page_path("sample.pdf".gsub(/\./, "%2E")) %>
Here's my setup:
ruby 1.8.7 (2009-06-12 patchlevel 174) [i686-darwin10.0.0]
Rails 3.0.0.beta3
Comments and changes to this ticket
-
Nando Vieira April 20th, 2010 @ 02:26 PM
- Tag changed from rails3 url_for bug to bug, rails3, url_for
-
Nando Vieira April 20th, 2010 @ 02:28 PM
- Tag changed from bug, rails3, url_for to 3.0.0.beta3, bug, rails3, url_for
-
Tim Rosenblatt April 21st, 2010 @ 04:50 AM
Could not reproduce when testing with
get '/:page' => "pages#show", :constraints => {:page => /.+/}, :as => :page
and
<%= link_to "Sample", page_path("sample.pdf") %>
under
ruby 1.8.7 (2008-08-11 patchlevel 72) [i686-darwin9]
Rails 3.0.0.beta3 -
kates April 21st, 2010 @ 10:49 AM
Could not reproduce it either using
ruby 1.8.7 (2010-01-10 patchlevel 249) [i686-linux]
Rails 3.0.0.beta3 -
Paul Barry April 24th, 2010 @ 08:29 PM
Not able to reproduce in master aaaa1782b44c620cecb97238534a2bd2be5d365a with ruby 1.8.7 (2009-12-24 patchlevel 248) [i686-darwin10.3.0], MBARI 0x6770, Ruby Enterprise Edition 2010.01
-
Andrew White June 28th, 2010 @ 01:51 PM
- State changed from new to resolved
- Importance changed from to Low
Appears to resolved in master - please post here if you can reproduce.
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>
People watching this ticket
Tags
Referenced by
- 5994 routing and url_for doesn't accept dots in the custom parameters https://rails.lighthouseapp.com/projects/8994/tickets/53...