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.
1. http://www.ruby-doc.org/stdlib/libdoc/erb/rdoc/classes/ERB/Util.html
--
Philip Ross
http://tzinfo.rubyforge.org/ -- DST-aware timezone library for Ruby