Thanks for your replay Jeff.

Unfortunately, declaring my scope with the "scope" method instead of a 
regular method returning an ActiveRecord::Relation doesn't solve my 
problem. (it also creates a new one since "2.days.ago" is only evaluated 
when the app loads the classes and not every time the method is called)

I think the includes method should support relations as well as 
associations (since associations/scopes/relations are so well integrated 
with eachother in rails 3).

That way the following :

  @articles = Article.includes(:comments => :recent)

would build the relation in a way that recent comments are eagerly 
loaded (instead of complaining that comments have no association named 
"recent")

Cheers,

M-Ryan
-- 
Posted via http://www.ruby-forum.com/.

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.

Reply via email to