Topic: Rails(/Ruby?) Rounds from 97.66 -> 97
Hello! I am calculating the average of a column from the DB and it's all dandy and stuff, but now I want to go from for example xx.xxxxxx -> xx.xx. This is what I'm doing:
average = @user.grades.calculate('avg', 'mark', :conditions => "include_overall = TRUE")
@average = (average * 100).round / 100
Now, the average from the database is exactly "97.6667", so it should become 97.66, no? No. It just becomes 97 I think this has something to do with Ruby, and not with Rails. Any ideas guys?