On Sep 17, 4:38 pm, "Conrad Taylor" <[EMAIL PROTECTED]> wrote:
> # Total number of issues open for a given ticket.
> ticket.issues.open.size  # performs a database query
>
> # Total number of issues open for a given ticket.
> ticket.issues.closed.size  # performs a database query
>
> Good luck,
>
> -Conrad

But I think that's exactly what surge wanted to avoid: a database
query every time he wanted to get the counts, specially if it's being
displayed on a list. Think of it as an N+1 problem.
--~--~---------~--~----~------------~-------~--~----~
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