ActiveRecord: how to preload just a column of a child

The find() method has a :include option to preload its children.
However, when I do something like this:

Article.find(:all, :include => [comments, :user])

The above call returns all the columns of both ‘user’ and ‘comments’,
and all of the article’s comments objects. I’d like to optimize it so
that it only returns comments.count and the field user.name in a single
find call with :include. Can that be done?

Thanks.

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs