[1, 2, 3].map{|h| "story_hash=#{h}"}.join("&")
#=> "story_hash=1&story_hash=2&story_hash=3"
I would also recommend using CGI.escape(h.to_s)
instead of h
, it would encode the values for url (unless HTTParty
already does that for you). So escaped version looks like:
[1, 2, 3].map{|h| "story_hash=#{CGI.escape(h.to_s)}"}.join("&")
#=> "story_hash=1&story_hash=2&story_hash=3"