yarb
Re:Using Nested Selects for Performance in Rails
on Friday July 10, 2015 @02:15AM (#9862527)
"But there is no easy way to do this in ActiveRecord without sacrificing eager loading."
Define a relationship:
has_many :approved_comments, class_name: "Comments", condtions: {approved: true}
Then eager load approved_comments.