# Eager load extended associations

**URL:** <https://www.ruby-forum.com/t/eager-load-extended-associations/180526>\
**Category:** Rails\
**Created:** [December 21, 2009, 9:43am UTC](https://www.ruby-forum.com/t/eager-load-extended-associations/180526 "2009-12-21T09:43:05Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![elioncho](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/e/ed8c4c/32.png) [@elioncho](https://www.ruby-forum.com/u/elioncho)\
**Post date:** [December 21, 2009, 9:43am UTC](https://www.ruby-forum.com/t/eager-load-extended-associations/180526/1 "2009-12-21T09:43:05Z")

</div>

Hello,

I was wondering which is the correct syntax to eager load via includes  
an extended association.  
For example, I’ll like to eager load the last\_message method:

class Conversation \< ActiveRecord::Base  
has\_many :messages do  
def last\_message  
find(:last)  
end  
end  
end

Thank you!

–

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 removed\_email\_address@domain.invalid.  
To unsubscribe from this group, send email to  
removed\_email\_address@domain.invalid.  
For more options, visit this group at  
[http://groups.google.com/group/rubyonrails-talk?hl=en](http://groups.google.com/group/rubyonrails-talk?hl=en).

---

<div class="post-metadata">

**Author:** ![elioncho](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/e/ed8c4c/32.png) [@elioncho](https://www.ruby-forum.com/u/elioncho)\
**Post date:** [December 21, 2009, 3:26pm UTC](https://www.ruby-forum.com/t/eager-load-extended-associations/180526/2 "2009-12-21T15:26:05Z")

</div>

On Dec 21, 8:42 am, elioncho [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> Hello,
> 
> I was wondering which is the correct syntax to eager load via includes  
> an extended association.  
> For example, I’ll like to eager load the last\_message method:

There’s no support for this that I know of

Fred

> class Conversation \< ActiveRecord::Base  
> has\_many :messages do  
> def last\_message  
> find(:last)  
> end  
> end  
> end
> 
> Thank you!

–

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 removed\_email\_address@domain.invalid.  
To unsubscribe from this group, send email to  
removed\_email\_address@domain.invalid.  
For more options, visit this group at  
[http://groups.google.com/group/rubyonrails-talk?hl=en](http://groups.google.com/group/rubyonrails-talk?hl=en).
