Displaying 2 results from an estimated 2 matches for "to_money".
Did you mean:
mg_money
2006 Jul 11
1
Validating composed_of
Hi,
How do I validate a composed_of attribute in my model?
I have a product model with:
composed_of :price, :class_name => ''Money'', :mapping => %w(cents cents)
This maps the price attribute to the Money
(http://dist.leetsoft.com/api/money/) class. I want to make sure that
the price only contains a price to 2 decimal places i.e. 1.25. This is
because if someone enters
2006 Feb 13
0
Money library error
Hello everyone !
The following test fails:
def test_substract_from_zero
assert_equal -12.to_money, Money.empty - (12.to_money)
end
This is equivalent to the normal arithmetic expression: 0 - 12 == -12.
The error is caused by the first line of Money#-(other_money)
def -(other_money)
return other_money.dup if cents.zero?
...
end
"return other_money.dup if cents.zero?" should be...