Displaying 1 result from an estimated 1 matches for "number_between_75_and_100_sold".
2010 Jan 27
4
Better way to count Active Record Data?
...laying just a total of the days sales that are
between different dollar amounts this way:
In my controller I grab all orders that are from today and return those
to the view as @orders
In my view I display the number sold that are in a particular price
range by the following helper method:
def number_between_75_and_100_sold
count = 0
for n in @orders
if n.total >= 75 && n.total < 100
count = count + 1
end
end
return count
end
This helper method feels ugly to me. I have 3 others that give me
different order total ranges. Better way?
If I use this same logic to cou...