Rails 3 ActiveRecord eager loading of scope
问题 Help me please. I have some model which has_many association with other model. For example: profile => has_many :statistics And inside of statistic model I have some scope: scope last_ten, limit(10).order('online desc') And question is how can I use eager load for this scope? I don't need every record of statistics for profile. Only scoped. Now I can use only User.profiles.includes(:statistics) Thanks. 回答1: As explained here: http://api.rubyonrails.org/classes/ActiveRecord/Associations