On Sep 17, 11:45 am, surge <[EMAIL PROTECTED]> wrote:
> Well, I'm trying to go the easy route first -- using eager loading.
>
> Interestingly enough, when I added ":issues" to :include, the query
> was correctly modified by rails to include a left join with issues. My
> expectation now was that when I did ticket.issues.count, no additional
> "count" query would be needed. But nope, Rails still does it.
>
> I kind of don't want to deal with a cache counter or :joins... I would
> like to ride the automation wave as long as possible...

It should have been:

ticket.issues.size

That way you only count the number of "issues". Running the scoped
count would do a COUNT from the db, irregardless if you've used eager
loading or not.
--~--~---------~--~----~------------~-------~--~----~
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