class Ransack::Nodes::Condition

def arel_predicate

def arel_predicate
  attributes.map { |attribute|
    association = attribute.parent
    if negative? && attribute.associated_collection?
      query = context.build_correlated_subquery(association)
      query.where(format_predicate(attribute).not)
      context.remove_association(association)
      Arel::Nodes::NotIn.new(context.primary_key, Arel.sql(query.to_sql))
    else
      format_predicate(attribute)
    end
  }.reduce(combinator_method)
end