This project is archived and is in readonly mode.

#6576 ✓resolved
fearless_fool

number_to_human < 1.0 raises TypeError: nil can't be coerced to fixnum

Reported by fearless_fool | March 14th, 2011 @ 06:40 PM

Passing a value whose magnitude is less than 1.0 raises "TypeError: nil can't be coerced to fixnum":

onyx[~/Developer/bd]$ rake about
About your application's environment
Ruby version              1.9.2 (x86_64-darwin10.6.0)
Rails version             3.0.3
onyx[~/Developer/bd]$ rails console
Loading development environment (Rails 3.0.3)
irb(main):001:0> include ActionView::Helpers::NumberHelper
=> Object
irb(main):002:0> number_to_human(0.5)
TypeError: nil can't be coerced into Fixnum
  from lib/ruby/gems/1.9.1/gems/actionpack-3.0.3/lib/action_view/helpers/number_helper.rb:475:in `**'
  from lib/ruby/gems/1.9.1/gems/actionpack-3.0.3/lib/action_view/helpers/number_helper.rb:475:in `number_to_human'
  from (irb):2
irb(main):003:0> number_to_human(-0.5)
TypeError: nil can't be coerced into Fixnum
  from lib/ruby/gems/1.9.1/gems/actionpack-3.0.3/lib/action_view/helpers/number_helper.rb:475:in `**'
  from lib/ruby/gems/1.9.1/gems/actionpack-3.0.3/lib/action_view/helpers/number_helper.rb:475:in `number_to_human'
  from (irb):3
irb(main):004:0> number_to_human(1.5)
=> "1.5"
irb(main):005:0> number_to_human(-1.5)
=> "-1.5"
irb(main):006:0>

[@José: pardon me if assigning it to you isn't the right protocol -- I'm new to this -- but I'm sure you'll reassign it as needed. Thanks.]

Comments and changes to this ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »

<h2 style="font-size: 14px">Tickets have moved to Github</h2>

The new ticket tracker is available at <a href="https://github.com/rails/rails/issues">https://github.com/rails/rails/issues</a>

Referenced by

Pages