I am working on a web application where I have to encode and decode a string at the JavaScript side and Ruby backend of the code. the only problem is that the escape methods
URI.escape was deprecated, an alternative is ERB::Util.url_encode.
ERB::Util.url_encode(foo)
If you are using it inside an .erb file you can do:
.erb
u(foo)