html - in rails erb file i want to display an output as a decimal only at one place where actually it is showing as a float value -
<div class='summary' align="justify" style='vertical-align: top;'> <div> {{:stats.tot_fte}} employees assigned   {{:stats.tot_fte_effort}} total effort </div> <div> {{:stats.tot_users}} users assigned     {{:stats.tot_user_effort}} total effort </div> </div> this code wrote display total effort output calculate total effort @ other place,where should float value use other calculations.but while displaying here want decimal value 2 numbers after decimal.please me in completing beginner. output follows,
340 employees assigned 340.89666666666665 total effort
453 users assigned 452.6066666666666 total effort
i want total effort display decimal value here.
since using rails, comes numbers helper in actionview. can use number_with_precision(number, options = {}).
for example:
number_with_precision 123.456, precision: 2
Comments
Post a Comment