1
在rails console
,這是可以做到這樣:在Rails 3的「rails runner」中,你如何使用number_to_human_size()方法?
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"
但對於在rails runner
?它是否作爲控制器運行?當我打印出來self.class
它只是說:Object