Pages

Tuesday, December 6, 2011

Ruby on Rails -=- Removing trailing zero

Hi! With RoR I'm always getting trailing zero for numeric fields. Example, 23 will be 23.0 In order to round theses values, simply do the following
"%g" % my_value
Where my_value is my variable

No comments:

Post a Comment