tags:

views:

102

answers:

2

hi,

I want to round of the ones and tens digit positon for the value..

if it is 1999, it should display as 1900

and if it is 19999 it should display as 19000

code goes like this

{overall_cost.to_money.format(:no_cents)}

A: 

You could use something like this:

def myround(value)
  return value if value < 100
  temp = value.to_s
  temp[0..1] + "0" * (temp.lenth - 2)
end
Veger
+1  A: 

You can round like this:

(n.to_i / 100) * 100

However, you are asking for a monkey patch so that :nocents is a valid argument to... money, I guess. I poked around the rails source and didn't see where the monkey patch should go.

Wayne Conrad