/ Published in: Ruby
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
# use Array#inject to calculate totals def number_of_incomings assets.inject(0) {|total, asset| total += asset.incomings.size } end
URL: http://www.therailsway.com/2007/1/10/assetsgraphed-part-2