On 2 Apr 2009, at 11:59, Frederick Cheung wrote:

>> In my controller I am finding the @phonecalls
>> And in my view I want to say @phoncalls.total_cost
>>
> The easiest way is probably to create a class method that takes as an
> argument the array and returns the total cost.

You could also run in your view e.g. @phonecalls.sum { |p| p.cost }

-Matt


--~--~---------~--~----~------------~-------~--~----~
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