4 5 6 7 8
# File 'lib/core-extensions/cgi_ext.rb', line 4 def self.url_for(url, params = nil) return url unless params params = params.map { |k,v| "#{k}=#{CGI.escape(v.to_s)}" }.join("&") url.index("?") ? "#{url}&#{params}" : "#{url}?#{params}" end