From: botp Date: 2010-09-07T17:35:29+09:00 Subject: Re: Round to two decimal place On Tue, Sep 7, 2010 at 4:16 PM, Tom Mac wrote: > Hi >   I have a variable  say  @price. It is either blank or has a value. If > it is blank I have to show it like  $ 0.00  . So I wrote helper like > > @price.blank? ? '$'+'0.00' : '$'+@price.to_s > > >     But the problem if @price has value 400.00  , after doing > @price.to_s  it changes to 400.0  What I want is exactly  400.00 .And if > I remove to_s above it will throw an error > can't convert BigDecimal into String try methods to_i, to_f, and % eg > "$%6.2f" % " ".to_f => "$ 0.00" > "$%6.2f" % 400.to_f => "$400.00" best regards -botp