This project is archived and is in readonly mode.
routing and url_for doesn't accept dots in the custom parameters
-
Andrew White
- State changed from new to invalid
- Importance changed from to Low
By default all routes have an optional format parameter added to them unless it is already in the route. To allow this to work dynamic segments don't allow periods by default. This can be overridden by using a regexp requirement and turning off format:
match '/assets/:file', :to => 'assets#show', :file => %r{[^/]+}, :format => falseAdjust the regexp to allow/disallow whatever characters you need. The example allows everything but slash - use /.+/ if you want to match anything.
BTW, this issue has cropped up multiple times - please use the ticket search to see if your issue has already been reported before creating a new ticket.
-
Pawel Barcik
I have checked the other tickets but I was looking for a valid tickets bafore.
I have found some other "invalid" tickets related to this subject but they werent actually pointing out this issue directly.
Below I am placing the links to other tickets for other users:https://rails.lighthouseapp.com/projects/8994/tickets/882-map-resource-nested-paths-don-t-always-resolve-properly https://rails.lighthouseapp.com/projects/8994/tickets/75-routing-receptors-with-a-dot-in-the-nameThat is all I was able to find, if you have any more examples , please add it in next comments.
From what I remember there was no direct information about it in the rails guides so maybe it would be worth putting it there
with big red letters ;) -
Andrew White
- State changed from invalid to open
- Milestone set to 3.x
- Assigned user set to Andrew White
Here's a few more that mention urls with periods in them:
https://rails.lighthouseapp.com/projects/8994/tickets/5399-routing-...
https://rails.lighthouseapp.com/projects/8994/tickets/2694-nested-r...
https://rails.lighthouseapp.com/projects/8994/tickets/2536-format-f...
https://rails.lighthouseapp.com/projects/8994/tickets/1064-named-ro...
https://rails.lighthouseapp.com/projects/8994/tickets/4443-url_for-...
https://rails.lighthouseapp.com/projects/8994/tickets/5208-new-rout...You're right though, it should be mentioned in the docs.
-
Repository
- State changed from open to resolved
(from [b4205b40ee893ae35ce468057e9ac62ffaea4ec4]) Add notes on how to override the default :id constraint [#5994 state:resolved] https://github.com/rails/rails/commit/b4205b40ee893ae35ce468057e9ac...
-
Repository
(from [fd7605826a6e4f7590e4abf42c6c9d0923afc4ef]) Add notes on how to override the default :id constraint [#5994 state:resolved] https://github.com/rails/rails/commit/fd7605826a6e4f7590e4abf42c6c9...