Thank you for your time:
I have a group of records (users to be specific) with an Hstore hash saved in a "data" field. The thing is I want to make a single SQL to fetch the users from that group of users with hash hstore saved property in that "data" field matching another array of strings values like this:
data: { "foo" => "", "bar" => "bars", "baz" => "bazz" }
array of strings to match ["foos", "bazz"]
NOTE: I want to match the values, NOT the keys
every user has a set of "data" foo/bar/bas properties, and I send an array of "keys" from the hash to extract and compare to the second "values" array but I can't seem to make a single SQL matching. So far this is all I have:
keys = ["foo", "baz"]
values_to_match = ["bars", "bazz"]
users.where("users.data -> ARRAY[?] ILIKE ANY (ARRAY[?])", keys, values_to_match)