I am consuming an API that expects me to do requests in the following format:
?filter=value1&filter=value2
However, I am using Active Resou
You can generate query strings containing repeated parameters by making a hash that allows duplicate keys. Because this relies on using object IDs as the hash key, you need to use strings instead of symbols, at least for the repeated keys.
(reference: Ruby Hash with duplicate keys?)
params = { consumer_id: 1 } # replace with self.id
params.compare_by_identity
params["filter"] = "value1"
params["filter"] = "value2"
params.to_query #=> "consumer_id=1&filter=value1&filter=value2"