That is pretty easy with a plain hash like
{:a => \"a\", :b => \"b\"}
which would translate into
\"a=a&b=b\" <
The best approach it is to use Hash.to_params which is the one working fine with arrays.
{a: 1, b: [1,2,3]}.to_param "a=1&b[]=1&b[]=2&b[]=3"