This project is archived and is in readonly mode.
Altered Rails Route Globbing breaks when non-strings passed
Reported by Sven Fuchs | May 12th, 2008 @ 07:27 PM
Not sure about the this consequences of this, but ...
Ticket #144 implemented in 6776edccf6fb553eb0ac6db55e1d30df1b5b6589 calls URI.escape on path_component which breaks when path_component is not a String.
E.g. I have a named route url helper containing a *permalink pathsegment to which I pass an array like: [published_at.year, published_at.month, published_at.day, id]. (This worked in 2.0.2)
This breaks with:
private method `gsub' called for 2008:Fixnum
/usr/local/lib/ruby/1.8/uri/common.rb:289:in `escape'
The solution could be to call #to_s on path_component before passing it to URI.escape.
Attached patch implements this change.
Comments and changes to this ticket
-
Pratik May 13th, 2008 @ 02:41 PM
And also, it'd be nicer if you create the .diff using git-format-patch, so that you get the credit when patch is committed :)
-
Pratik May 13th, 2008 @ 02:55 PM
- State changed from new to incomplete
-
Sven Fuchs May 13th, 2008 @ 09:12 PM
Sure :)
Attached patch includes a failing test case as well as the fix and is done with git-format-patch.
-
Rick May 13th, 2008 @ 09:13 PM
- State changed from incomplete to open
-
Pratik May 16th, 2008 @ 05:37 PM
Committing using .to_param instead of .to_s and minor modification to the test.
Thanks.
-
Repository May 16th, 2008 @ 05:37 PM
(from [345f030c5b6c0a28ddde56c80a1112b00d345c79]) Ensure routing generator works with non-string keys. [#172 state:resolved]
Make sure that (with recent correction to globbed parameter escaping) non-string
values can still be passed route generation helpers for globbed route segments.
For example, foo_path([1, 2, 3]) should still work for a route like map.foo "*globbed"
by implicitely calling to_s on the Fixnums.
Signed-off-by: Pratik Naik
-
Pratik May 17th, 2008 @ 11:57 AM
- State changed from open to resolved
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>