Categories: English Geeky

I just released a prefixed_attributes plugin for Rails.

Rails has a handy number_to_human_size method, but in order to use it, all
your quantities need to be in non-scaled units, and it’s cumbersome to have
your users typing 100 gigabyte amounts by hand. You’d normally have a
“bytes” column in your records and add virtual attributes to your models.
This plugin adds those attributes for you.
The plugin adds a prefixed_attribute method to all your classes. Use it to mark an
existing attribute on your class (even a non-AR one) like this:

prefixed_attribute :bytes, :type => :binary  
prefixed_attribute :hertz, :type => :si

More information here.