The code in question looked like this (shortened version):
def count_of_beats_by_kind
set = @project.beats
list = BEAT_KINDS
list.each do |kind|
counts[kind] = set.where(:kind => kind).count.to_f
end
counts["total"] = set.count.to_f
return counts