【发布时间】:2011-07-21 01:50:52
【问题描述】:
我正在尝试根据条件抓取帖子,并且只抓取属于该帖子的 cmets:
即。
# Grab all posts but only include comments that have been approved.
Post.all(:include => :comments, :conditions => ['comments.approved = ?', true])
2011 年 7 月 20 日 10:11 EST 更新
为了澄清,我正在尝试抓取特定用户的所有帖子,并且只抓取该帖子的 cmets。
def grab_posts_and_only_comments_from(user)
{:include => [:comments], :conditions => ['comments.user_id = ?', user.id]}
end
美国东部时间 2011 年 7 月 20 日 11:34 更新
在选中答案的评论中回答。
【问题讨论】:
-
这不是一个澄清,实际上是一个新问题:)
-
对此感到抱歉。你知道我怎么能这样吗?我愿意接受任何建议。
标签: ruby-on-rails ruby-on-rails-3