Dan Manges wrote: > def subscriber_salaries > subscribers.map(&:salary).sum > end
That's inefficient. If you measure your application and find it will cause a bottleneck, you must put the sum, and the addition, on the database side. That crunches the numbers while they are much closer to the hard drive. (However, if it's not time-critical code, stay with that solution, because it's easier to type in Ruby!!) --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---

