how to get human readable size in controller


     i know i can use human_size helper in views, but what if I need to emit human readable size in the controller e.g. in an error message?

find the relevant code from human_size, copy it, and put it someplace that's accessible to your models

Here's a good suggestion: