Comment

Comment by yarb

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

parent yarb 11 years ago

Discussion

Live from the official Hacker News API

A modern reader for Hacker News · SvelteKit + Skeleton