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)}
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.
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
精彩评论