I have a variable that I want to force 2 and always 2 decimal im Looks like a low comparison.
if self.price! = Value #de some end where self.price = 120.00 and value = 120.0 . self.price is set with a : exact = & gt; 2 in the model, but how can I do this with a variable, because it seems unsuccessful
class numerical def round_to (decimal = 0) factor = 10.0 ** decimal (auto * factor). / End the end factor if self.price.round_to (2)! = Price.round_to (2) #do something end
Comments
Post a Comment