In a rails console
, it can be done this way:
ree-1.8.7-2010.02 > helper.number_to_human_size 1
=> "1 Byte"
ree-1.8.7-2010.02 > helper.number_to_human_size 100000
=> "97.7 KB"
ree-1.8.7-2010.02 > helper.number_to_human_size 0
=> "0 Bytes"
ree-1.8.7-2010.02 > helper.number_to_human_size 100000000
=> "95.4 MB"
but what about in a rails runner
? Is it running as a Controller? When I print out self.class
it merely says Object