In my opinion, the best way is the first way that works.  If that
method proves to be too inefficient, then optimize afterwards.


On Jan 28, 10:03 am, Neal L <[email protected]> wrote:
> Hi all,
>
> I'm trying to find the most effective way to generate an aggregation
> report.  The models involved are:
>
> Customer  --(has_many)--> Charges
> Charges --(have_one)-->Account
>
> What I'm trying to do is find the total charges during the year for
> each customer by account.  In other words, a function like:
>
> customer.charges_for_year()
>
> in the customer model that will return a hash of each account charged
> and the customer's total charges to that account.
>
> From what I've read I don't think I should be using named_scope, since
> this involves associations...
>
> Any ideas?
>
> Thanks!
--~--~---------~--~----~------------~-------~--~----~
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