How to use url_escape in controller?


#1

I know one can use <%=u “a string” %> to use the url_escape function in
ROR and convert “a string” to “a%20string”

I tried using url_escape and u in my controller but none of them work
and I get a function unknown error.

Can anyone please guide me as to how I can use the url escape function
in my controller?

I appreciate your help

Thanks
Frank


#2

softwareengineer 99 wrote:

I know one can use <%=u “a string” %> to use the url_escape function in
ROR and convert “a string” to “a%20string”

I tried using url_escape and u in my controller but none of them work
and I get a function unknown error.

Can anyone please guide me as to how I can use the url escape function
in my controller?

The u method is actually an alias for url_encode rather than url_escape.
It is contained within the ERB::Util module [1]. In your controller,
include ERB::Util and you will be able to use it.

http://www.ruby-doc.org/stdlib/libdoc/erb/rdoc/classes/ERB/Util.html


Philip R.
http://tzinfo.rubyforge.org/ – DST-aware timezone library for Ruby