lib/inventory_refresh/inventory_collection.rb
def build_multi_selection_condition(hashes, keys = unique_index_keys)
      arel_table = model_class.arel_table
      # We do pure SQL OR, since Arel is nesting every .or into another parentheses, otherwise this would be just
      # inject(:or) instead of to_sql with .join(" OR ")
      hashes.map { |hash| "(#{keys.map { |key| arel_table[key].eq(hash[key]) }.inject(:and).to_sql})" }.join(" OR ")
    end
def build_multi_selection_condition(hashes, keys = unique_index_keys)
      arel_table = model_class.arel_table
      # We do pure SQL OR, since Arel is nesting every .or into another parentheses, otherwise this would be just
      # inject(:or) instead of to_sql with .join(" OR ")
      hashes.map { |hash| "(#{keys.map { |key| arel_table[key].eq(hash[key]) }.inject(:and).to_sql})" }.join(" OR ")
    end
Builds a multiselection conditions like (table1.a = a1 AND table2.b = b1) OR (table1.a = a2 AND table2.b = b2)

 @param hashes [Array<Hash>] data we want to use for the query
 @param keys [Array<Symbol>] keys of attributes involved
 @return [String] A condition usable in .where of an ActiveRecord relation