_weisite = Weisite.find_by(user: current_user)
_weimembers = Weimember.where(weisite: _weisite)
@weishoporders = Weishoporder.where(weimember_id: _weimembers).order("created_at desc")
这样可以把一个站点的订单都查询出来
但是生成的 SQL 语句为:
SELECT "weishoporders".* FROM "weishoporders" WHERE "weishoporders"."weimember_id" IN (SELECT "weimembers"."id" FROM "weimembers" WHERE "weimembers"."weisite_id" = 3) ORDER BY created_at desc
有更好的查询方式吗?