currency - Rails 2 - Absolute of money -


how absolute value of money? e.g:

-2.to_money.? = 2.to_money  2.to_money.? = 2.to_money 

i have attribute total_price, may positive or negative. want calculate absolute value of total_price.

try taking absolute value before converting money.

2.abs.to_money


Comments

Popular posts from this blog

How to logout from a login page in asp.net -

Stack level too deep error after upgrade to rails 3.2 and ruby 1.9.3 -