我有 3 个模型
a is client
b is team leader
c is worker
现在
a has_many b through ab,
b has_many c through bc和
a has_many c through ac.
ab,bc,ac我的连接表是由has_many through association
现在
a can create b,
b can create c和
a can create c
ie worker 可以由Client和创建Team leader。
现在我需要检索所有workers由clientand创建的TeamLeader。虽然我可以在控制器中编写if/else条件,但我只想从单个查询中获取所有记录?还是我应该使用正常的 if/else 条件?