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

PHP Error "Undefined index" -

C# List<> to xml -

php - How to only save new tweets/instagram photos to database? -