views:

64

answers:

1

Dear experts,

is there any existing rails helper to create a valid URL?

Specifically, I am generating a Web URL with some parameters that having special character (for e.g space i need to convert into + , and many others special characters).

http://domain.name?param1=ABC+DEF&param2=GHI

Thanks.

+3  A: 

You can use CGI.escape to do that.

CGI.escape("foo bar") # 'foo+bar'
x1a4