Hi all,

Just curious if anyone knows a cleaner way to write this query...


def payments_for(start_on, end_on)
    sum = 0
    self.leases.each { |lse|
        sum += lse.payments.within(start_on, end_on).sum(:amount)
    }
    sum
end

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