I\'m trying to calculate the average net price of a product. I have, in my Product model :total_sold and :total_net_revenue. Doing straight division in the method seems to a
You need to convert your values that are in whole cents (integers) to floats (numbers with decimals) so that the math will result in a floating number instead of an integer.
So in general it works like this:
some_integer.to_f / some_other_integer.to_f # returns a float