call_status が open で unit_id が nil のコール レコードを検索するスコープがあります。
scope :unassigned_calls, where(:call_status => "open", :unit_id => nil).order("id ASC")
私は最近、call_unit モデル結合テーブルの unit_ids というフィールドの代わりに、call モデルで unit_id が使用されなくなった has_many 関係をセットアップしました。
結合テーブルの unit_ids を含むスコープまたはラムダを表現するにはどうすればよいですか?