joins and includes

User.joins(:user_corps).where("user_corps.corp_id in (?) and user_corps.is_onjob = ?", [1,3,5],1).order('user_corps.id desc')


 
Event.includes(:category).where( :category => { :position => 1 } )
原文地址:https://www.cnblogs.com/qinyan20/p/3643320.html