url encode equivalent in ruby on rails

I believe the u helper method is what you’re looking for:

<%=u "URL ENCODE <p>ME</p>" %>

This uses the method ERB::Util.url_encode, which is aliased to u.

You can find the documentation for this method here: http://rdoc.info/stdlib/erb/1.8.7/ERB/Util:url_encode.

Leave a Comment