Encode URLs with Ruby

Prior to Ruby 3 the way to encode URLs was using URI.escape, after Rails 3 you need to use CGI.escape