Plugins - Correct number units
Add to favoritesThe Rails framework prides itself on being very strict about things like
the HTTP protocol (cleary seen in the excellent REST implementation), testing
practices, MVC (model-view-controller) separation and more. This is why
some people were surprised to see that number conversion methods of ActiveSupport
like 1.kilobyte or 1.megabyte still measure in wrong units.
A kilobyte is 1000 bytes, not 1024 like the current implementation. This
inconsistency has been the source of many confusion and lawsuits (typical companies
sued were those who advertise hard-disk capacity in wrong units). The article that
sums this up nicely is A plea for sanity.
What is 1024 bytes, then? Well, 1024 bytes is a kibibyte. Following that is
mebibyte, gibibyte and so on. Those prefixes indicate that we are measuring
in base 2 units (the powers of 2). Kilo and mega were always strictly powers of 10.
Prefixes for binary multiples, dated 1998.
This plugin corrects everything in Rails, including the number_to_human_size
helper of ActiveView. It is to be used by people who believe in standards and who
respect their users enough not to show numbers measured in wrong units.

The 'ruby-units' gem also correctly handles these and many more units.