Perhaps the name of this question is cryptic, but the problem is real, I just updated the application from Rails 3 to 4 and ran into the following problem (on Ruby 2.0 and 2.1):
I have a method that calls several URL helpers in a loop using send (), for example:
class Sitemap include Rails.application.routes.url_helpers #... # regions = [:city, :county, :zip] regions.each do |region| url_params = ... # [name, additional_id] send("#{region}_url", url_params) end
Rails 3 above lists URLs like http://example.com/cities/atlanta/2
In Rails 4, I get http://example.com/cities/atlanta%2f2
slash gets CGI, I don't want this. I use it to generate a sitemap XML file for my site and it seems to work even if the forward slash is escaped but looks ugly and I donβt know if it will work correctly for all bots or clients.
UPDATE: after some debugging, I found that CGI escaping happens somewhere in ActionDispatch :: Journey :: Visitors :: Formatter
Router::Utils.escape_segment()
source share