Forum: Ruby on Rails How to use url_escape in controller?

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
F68e4842b0a5487678e26046fdb2fdf3?d=identicon&s=25 softwareengineer 99 (Guest)
on 2006-02-09 04:09
(Received via mailing list)
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
9ab183bb240ffd3a3966d5a615b4bdeb?d=identicon&s=25 Philip Ross (Guest)
on 2006-02-10 01:47
(Received via mailing list)
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/cla...

--
Philip Ross
http://tzinfo.rubyforge.org/ -- DST-aware timezone library for Ruby
This topic is locked and can not be replied to.