0
可以说一个作者有很多帖子,一个帖子有很多评论。 你怎么能选择特定作者特定几篇文章的所有评论?选择特定帖子的所有评论mongoid 2 rails 3.1
使用案例:我想最近的每一个作者的与标签“轨道”
@author = Author.find(params[:author_id])
@posts = @author.posts.where(:tag => 'rails')
现在
@comments = @posts.?????.where(:created_at.gte = 1.month.ago)
你能缩短到:Comment.where(:POST_ID => @ posts.map(&:ID)) –