0
我有两个表Promo
和Image
的Rails获得第二条记录连接的表
Promo
具有ID和名称
Image
已经PROMO_ID名和img_url
assosiations =>宣传片的has_many图像
和我想从image
表中获取第二条记录,其中promo_id 1,
for_example如果我这样做Promo.first.images.second
这是不好的perfomace 如果我的形象表中有很多记录
所以我想我需要这样的东西Promo.joins(:images).where('????')