Parse string as if it were a querystring in Ruby on Rails

Posted by Koning WWWWWWWWWWWWWWWWWWWWWWW on Stack Overflow See other posts from Stack Overflow or by Koning WWWWWWWWWWWWWWWWWWWWWWW
Published on 2010-05-05T11:38:29Z Indexed on 2010/05/05 11:58 UTC
Read the original article Hit count: 241

I have a string like this:

"foo=bar&bar=foo&hello=hi"

Does Ruby on Rails provide methods to parse this as if it is a querystring, so I get a hash like this:

{
    :foo => "bar",
    :bar => "foo",
    :hello => "hi"
}

Or must I write it myself?

EDIT

Please note that the string above is not a real querystring from a URL, but rather a string stored in a cookie from Facebook Connect.

© Stack Overflow or respective owner

Related posts about ruby-on-rails

Related posts about parsing