我的网站上有一个特色部分,其中包含三种类型的特色帖子:普通、大和小。目前我正在三个单独的查询中获取这三种类型,如下所示:
@featured_big_first = Post.visible.where(pinged: 1).where('overlay_type =?', :big).limit(1)
@featured_big_first = Post.visible.where(pinged: 1).where('overlay_type =?', :small).limit(1)
@featured_big_first = Post.visible.where(pinged: 1).where('overlay_type =?', :normal).limit(5)
基本上,我正在寻找一个将这三者合二为一并获取 1 个大、1 个小、5 个普通帖子的查询。