How to get human readable size in controller

hi,

     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?


Ishaq
http://blogs.kahaf.com/ishaq

  • Programming can be fun, so can be cryptography, however they should
    not be
    combined …

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

Here’s a good suggestion:

http://pinds.com/2005/10/18/rails-calling-view-helpers-from-your-controller

-Danimal

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs