Better HN
topnewbestaskshowjobs
Log inSign up

yarb

1 karma · joined Jul 10, 2015 (11y ago) · 1 submissions

Submissions

comment 11y ago · link · parent

"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.