My app has a model called Plan, which has has_many self-referential
association just like
has_many :counterparts, :through => :matches
has_many :inverse_matches, :class_name => "Match", :foreign_key =>
has_many :inverse_counterparts, :through => :inverse_matches,
:source => :plan
and in the plans_controller, I would like to find a plan (counterpart)
having many conditions.
plans = Plan.arel_table
@counterpart = Plan.where(
# eliminate current user
in addition to this, I need one more condition. That is
A Plan (counterpart) which has yet been found by any plans. It should
counterpart.matches.length == 0
How can I add this condition to the where clauses describe above?