def hash_to_condition(table, hash)
      conditions = hash.map do |attr, value|
        if value.is_a?(Array) && value.size > 1
          table[attr].in(value)
        elsif value.is_a?(Array)
          table[attr].eq(value[0])
        else
          table[attr].eq(value)
        end
      end

      conditions.reduce { |memo, cond| memo.and(cond) }
    end
def hash_to_condition(table, hash)
      conditions = hash.map do |attr, value|
        if value.is_a?(Array) && value.size > 1
          table[attr].in(value)
        elsif value.is_a?(Array)
          table[attr].eq(value[0])
        else
          table[attr].eq(value)
        end
      end

      conditions.reduce { |memo, cond| memo.and(cond) }
    end
Converts a hash into arel conditions