yes it's easily handled in the controller. I just thought it odd that
it worked under rails 1.2.5 but not 2.0.2
I don't allow + in tags. I also use space as tag separator, since I
figure I display tag cloud using space as separator, so it's less
confusing to the user if I require them to enter tags that way. To
have compound word tags, I ask them to use - , e.g., pop-culture.
(this makes for a nicer url /posts/tags/pop-culture instead of /posts/
tags/pop%20culture.) Now I wonder if the default comma as tag
separator isn't the better way to go.
I'm running into this exact same problem. On rails 1.2.6, by default
my paths that included a name with spaces used + instead of the space.
So we have URLs like
/lists/Best+Movies
When I tried upgrading to 2.0, link_to now generates this
/lists/Best Movies
So now all my old URLs are broken. Any ideas? I'm surprised more
people aren't feeling this pain.
Oh, I'm no routing expert by any means, so there's definitely a chance
that something weird in my setup is causing this (especially of others
aren't have this problem). I looked over my routes.rb and don't
*think* I'm doing anything weird, but I've certainly been wrong
before.
Any and all ideas about the source of the problem or possible
workarounds would be much appreciated. Thanks!
OK, after digging around a little bit in actionpack-2.0.2/lib/
action_controller/routing.rb, it looks like Rails has switched from
using CGI.escape to URI.escape. And you can clearly see the difference
in the console
CGI.escape(' ')
=> "+"
URI.escape(' ')
=> "%20"
So, my question becomes - does anyone know if this change in behavior
(in the case of spaces) was intentional? Are reason why the old
behavior is not supported? And any ideas on workarounds
(realistically, changing all our links isn't a great option because
we'll break existing incoming links to our app).