URL encoding in Rails?

Simple question:

How does one do URL encoding in Ruby/Rails?

Thanks,
Wes

Wes G. wrote:

Simple question:

How does one do URL encoding in Ruby/Rails?

Thanks,
Wes

Check out CGI.escape(). CGI is part of the Ruby standard library.
Typically you’ll want to pass in just a querystring parameter value (not
the entire URI).

–Ed

And CGI.escape_skipping_slashes added in Rails’ Active Supprt. It’s good
for a pathname, but not for a URL with hostname.

DD

Ed Lau wrote:

Wes G. wrote:

Simple question:

How does one do URL encoding in Ruby/Rails?

Thanks,
Wes

Check out CGI.escape(). CGI is part of the Ruby standard library.
Typically you’ll want to pass in just a querystring parameter value (not
the entire URI).

–Ed

Try:
CGI::escape(‘scott walter’)

You may need to require “CGI”

scott.


What’s an Intel chip doing in a Mac? A whole lor more that it’s ever
done in a PC.

My Digital Life - http://scottwalter.com/blog
Pro:Blog - http://scottwalter.com/problog

----- Original Message ----
From: Wes G. [email protected]
To: [email protected]
Sent: Monday, May 1, 2006 10:05:08 AM
Subject: [Rails] URL encoding in Rails?

Simple question:

How does one do URL encoding in Ruby/Rails?

Thanks,
Wes

That’s a very vague question.

Simple Answer:
routes.rb