This project is archived and is in readonly mode.
path helper problem
Reported by Alexey Poimtsev | December 7th, 2010 @ 09:01 PM
Hi,
i'm expecting some problem with path helpers. Let me explain. I
have some resource "issues" in my routes and would like to use
helper with parameter issue_path("something").
Everything works fine if parameter does not contain dot(.) symbol,
but for issue_path("some.thing") it will cause
error like
ActionController::RoutingError in Issues#index
Showing /Users/alec/Documents/Projects/prj/app/views/issues/_issue.html.haml where line #30 raised:
No route matches {:controller=>"issues", :id=>"some.thing", :action=>"show"}
Comments and changes to this ticket
-
2kan December 8th, 2010 @ 02:30 PM
I don't think that it is a bug. I think there is a reason why you can't use dots.
If you are interested here is a regexp for such route:
/\A\/issues\/([^\/.?]+)(?:\.([^\/.?]+))?\Z/
Here are segments (for better understanding) for this route:
segments: ["/issues/", /(?<id>\A[^/.?]+\Z)/, [".", /(?<format>\A[^/.?]+\Z)/]]
I think you can't use dots because of format segment but i'm not sure, any ideas why dot is not allowed?
-
2kan December 8th, 2010 @ 02:34 PM
Yes, of course '.' is not allowed because it is separator for format.
-
Alexey Poimtsev December 8th, 2010 @ 02:38 PM
ok, but sometimes we need to send '.' in path, what about encode/escape dot symbol?
-
Neeraj Singh December 8th, 2010 @ 06:03 PM
- Importance changed from to Low
In routes mention :format => false and then use your regex and then dot will be allowed.
-
Andrew White February 9th, 2011 @ 06:50 AM
- State changed from new to invalid
And #5994 where I've listed some more tickets that have reported the same problem.
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>