I’m trying to grab Posts and only the comments that belong_to that Post based on a conditional:
ie.
# Grab all posts but only include comments that have been approved.
Post.all(:include => :comments, :conditions => ['comments.approved = ?', true])
Update July 20, 2011 10:11 EST
To clarify, I’m trying to grab all posts and only the comments of that post by a specific user.
def grab_posts_and_only_comments_from(user)
{:include => [:comments], :conditions => ['comments.user_id = ?', user.id]}
end
UPDATED JULY 20, 2011 11:34 EST
Answer in the comment of the checked answer.
The documentation on this feature is much improved in the EdgeGuides. Check out Section 12.2 here.