If I convert a hash to a query string, how can I convert it back again?
{:filters => {:colour => ['Red', 'Blue'], :size => 'Medium'}}.to_param
=> "filters[colour][]=Red&filters[colour][]=Blue&filters[size]=Medium"
Rails appears to do this automatically when it populates the params hash, but is it possible to call this method directly?
Thanks.
You’re looking for
Rack::Utils.parse_nested_query(query), which will convert it back into aHash. You can get it by using this line: