Skip to content

Instantly share code, notes, and snippets.

View jeperkins4's full-sized avatar

John Perkins jeperkins4

  • RedHills Software
  • Tallahassee, FL
View GitHub Profile
@jeperkins4
jeperkins4 / gist:3012524
Created June 28, 2012 16:59
Refactor of InvoiceLedger detailed_invoiced_equipments_by_location
Originally...
def invoiced_equipments_by_location
locations = {}
self.invoiced_equipments.each do |e|
if locations[e.equipment.location].nil?
locations[e.equipment.location] = 1
else
locations[e.equipment.location] = locations[e.equipment.location] + 1
end