URL encoding

Hi, is there any built-in function to convert

{:foo=>1, :bar=>2}

into

foo=1&bar=2

?

Shortest thing I could come up with was:

def urlencode(hash)
     hash.to_a.collect! { |k, v| "#{k}=#{v.to_s}" }.join("&")
end

--Jonas Galvez