I'm trying to patch routing.rb to have the named route methods (home_url, login_url etc) html_escape the URL like url_for currently does. This is required when using XHTML 1.1 to have a well-formed document.
I've pastied the part of routing.rb that I've changed (NamedRouteCollection) here:
This works fine in the browser, and I can use home_url(:foo => 'bar', :alpha => 'beta') and the URL will be properly escaped. But when i run rake in vendor/rails/actionpack one of the tests fails:
It's an ActiveRecord test testing some session stuff, and I can't figure out why my changes are making it fail. I haven't set up any test database or anything like that, could that be the cause? When I run rake without my changes to routing.rb it doesn't fail, though, and I've traced the cause of the failure to line 127 in the first pastie. Does anyone have an idea why it's failing?
Also, is this patch likely to be accepted if I submit it? Should I change anything? I've refactored the code a bit to allow the helpers to use url_for, which has the :escape option, allowing the named helpers to accept this option too. Is there any tests I can write to check that my changes work properly?
I've also pastied the diff here in case anyone wants to test it for themselves: