Eager loading is nice with the include attribute
Post.find(:all, :include => :author)
I\'m wondering if you can also eager load counts, like
I just ran into this challenge and solved it this way:
def trainee_counts @trainee_counts ||= Hash[Trainee.group(:klass_id).count] end # where the count is needed trainee_counts[klass_id].to_i
One call to database and does not load trainees.