This project is archived and is in readonly mode.
number_to_human_size only working properly when :precision and :separator given
-
CancelProfileIsBroken
- Tag set to bugmash
-
Dmitry Maksimov
+1 verified
The issue reproduce if user set his own locale and not define number[:human][:format] or number[:format] details.
Not sure that this is a bug... -
Blue Box Chris
-1 for Ruby 1.8.6 with Rails 2.0.5
number_to_human_size(10000000000)
NoMethodError: undefined methodnumber_to_human_size' for #<Object:0x2af485abb338><br/>from (irb):1include ActionView::Helpers::NumberHelper => Object number_to_human_size(10000000000) => "9.3 GB"
-
Matías Flores
verified in 2-3-stable
steps to reproduce:
- create a custom locale file (e.g. es.yml) on
config/locales
- make sure you are not defining any number[:human][:format] nor
number[:format] settings as kolo mentioned
- call number_to_human_size specifying the locale you have just configured. E.g. helper.number_to_human_size(100000000, :locale => :es)
The wrong behavior gets fixed either by setting the number/human/format details in the locale file or by including :precision and :separator options in the call to number_to_human_size helper.
- create a custom locale file (e.g. es.yml) on
config/locales
-
Rizwan Reza
- State changed from new to open
- Tag changed from bugmash to actionview, i18n, locale
- Milestone set to 2.3.6
-
Prem Sichanugrist (sikachu)
- Assigned user set to Prem Sichanugrist (sikachu)
-
Sven Fuchs
TBH, i don't think this is a bug, so -1
It's an incomplete locale file. So far we don't do local fallbacks in Rails.
So, to fix this one could
- either complete the locale file
- or enable locale fallbacks in the I18n backend (e.g. include I18n::Backend::Fallbacks to I18n::Backend::Simple)
-
Prem Sichanugrist (sikachu)
- State changed from open to invalid
As said by Sevn Fuchs, I think you should complete it or use fallback backend.