在 arails console
中,可以这样做:
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"
但是在 a 中rails runner
呢?它作为控制器运行吗?当我打印出来时,self.class
它只是说Object