ActiveRecord Support for Sanitizing and Serializing Nested Arrays

Filtering over multiple composite fields is trivial in SQL and tricky in ActiveRecord. For example:

FROM "addresses"
WHERE ("addresses"."city", "addresses"."state", "addresses"."country") IN (
  ('Juneau', 'AK', 'US'), 
  ('Albany', 'NY', 'US'),

Seems to require lots of manual connection escaping + serialization:

searches = [
  ['Juneau', 'AK', 'US'],
  ['Albany', 'NY', 'US'],

searches_sql = do |search| 
  "(#{ { |query| Address.connection.quote(query) }.join(', ')})"
end.join(', ')
Address.where("city, state, country) IN (#{searches_sql})")

This feature request is to enable the above query being re-done as:

Address.where('(city, state, country) IN (?)', [
  ['Juneau', 'AK', 'US'],
  ['Albany', 'NY', 'US'],

Alternatively - supporting a general syntax that automatically transforms even root arrays into tuples:

Address.where('(city, state, country) IN ?', [
  ['Juneau', 'AK', 'US'],
  ['Albany', 'NY', 'US'],
Address.where('city IN ?', %w[Juneau Albany])