This project is archived and is in readonly mode.
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
-
Josh Kalderimis March 16th, 2011 @ 05:55 PM
- Tag changed from actionpack, actionview, rails3.0.3 to action_pack, action_view
- State changed from new to verified
- Assigned user changed from José Valim to Santiago Pastorino
- Importance changed from to Low
I can confirm that this is an issue on master and 3-0-stable.
The following patch has been supplied for review by Santiago
https://github.com/joshk/rails/commit/5387a52677d41b41d7431a8e9b78d...
-
Repository March 16th, 2011 @ 06:12 PM
- State changed from verified to resolved
(from [0eae62525696b57fe7fc4bbb0bf9c0bc7ee4e480]) fixes an issue with number_to_human when converting values which are less than 1 but greater than -1 [#6576 state:resolved]
Signed-off-by: Santiago Pastorino santiago@wyeworks.com
https://github.com/rails/rails/commit/0eae62525696b57fe7fc4bbb0bf9c... -
Repository March 16th, 2011 @ 06:13 PM
(from [7c8a5f5759a0c63945d133280fb78deaa86b65b9]) fixes an issue with number_to_human when converting values which are less than 1 but greater than -1 [#6576 state:resolved]
Signed-off-by: Santiago Pastorino santiago@wyeworks.com
https://github.com/rails/rails/commit/7c8a5f5759a0c63945d133280fb78...
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>
People watching this ticket
Tags
Referenced by
- 6576 number_to_human < 1.0 raises TypeError: nil can't be coerced to fixnum (from [0eae62525696b57fe7fc4bbb0bf9c0bc7ee4e480]) fixes a...
- 6576 number_to_human < 1.0 raises TypeError: nil can't be coerced to fixnum (from [7c8a5f5759a0c63945d133280fb78deaa86b65b9]) fixes a...