Ruby 2.4.1 - 警告:不推荐使用constant :: Fixnum

时间:2017-06-10 17:15:29

标签: ruby-on-rails ruby

我是StackOverflow和Rails的新手,所以我希望这不是一个太天真的问题。我正在尝试使用bin / rails服务器在本地运行我的应用程序。当我输入时,我收到以下痕迹:

=> Booting Puma
=> Rails 4.2.5 application starting in development on http://localhost:3000
=> Run `rails server -h` for more startup options
=> Ctrl-C to shutdown server

    /Users/name/.rvm/gems/ruby-2.4.1/gems/activesupport-4.2.5/lib/active_support/core_ext/numeric/conversions.rb:121: warning: constant ::Fixnum is deprecated
    /Users/name/.rvm/gems/ruby-2.4.1/gems/activesupport-4.2.5/lib/active_support/core_ext/numeric/conversions.rb:121: warning: constant ::Bignum is deprecated
    Exiting
    /Users/name/.rvm/gems/ruby-2.4.1/gems/activesupport-4.2.5/lib/active_support/core_ext/numeric/conversions.rb:125:in `block (2 levels) in <class:Numeric>': stack level too deep (SystemStackError)
        from /Users/name/.rvm/gems/ruby-2.4.1/gems/activesupport-4.2.5/lib/active_support/core_ext/numeric/conversions.rb:131:in `block (2 levels) in <class:Numeric>'
        from /Users/name/.rvm/gems/ruby-2.4.1/gems/activesupport-4.2.5/lib/active_support/core_ext/numeric/conversions.rb:131:in `block (2 levels) in <class:Numeric>'
        from /Users/name/.rvm/gems/ruby-2.4.1/gems/activesupport-4.2.5/lib/active_support/core_ext/numeric/conversions.rb:131:in `block (2 levels) in <class:Numeric>'
        from /Users/name/.rvm/gems/ruby-2.4.1/gems/activesupport-4.2.5/lib/active_support/core_ext/numeric/conversions.rb:131:in `block (2 levels) in <class:Numeric>'
        from /Users/name/.rvm/gems/ruby-2.4.1/gems/activesupport-4.2.5/lib/active_support/core_ext/numeric/conversions.rb:131:in `block (2 levels) in <class:Numeric>'
        from /Users/name/.rvm/gems/ruby-2.4.1/gems/activesupport-4.2.5/lib/active_support/core_ext/numeric/conversions.rb:131:in `block (2 levels) in <class:Numeric>'
        from /Users/name/.rvm/gems/ruby-2.4.1/gems/activesupport-4.2.5/lib/active_support/core_ext/numeric/conversions.rb:131:in `block (2 levels) in <class:Numeric>'
        from /Users/name/.rvm/gems/ruby-2.4.1/gems/activesupport-4.2.5/lib/active_support/core_ext/numeric/conversions.rb:131:in `block (2 levels) in <class:Numeric>'
         ... 5603 levels...
        from /Users/name/.rvm/rubies/ruby-2.4.1/lib/ruby/site_ruby/2.4.0/rubygems/core_ext/kernel_require.rb:68:in `require'
        from /Users/name/spending-tracker-master/bin/spring:13:in `<top (required)>'
        from bin/rails:3:in `load'
        from bin/rails:3:in `<main>'

我不相信我可以忽略它(warning: constant ::Fixnum is deprecated When generating new model),因为它不会在本地打开应用程序。

有人可以帮忙吗?

谢谢! 本

1 个答案:

答案 0 :(得分:12)

Ruby 2.4将FixnumBignum统一到一个类Integer中。当Rails(ActiveSupport的core extensions准确)尝试对上述类进行修补时,会发生错误。

这是Rails 5中的fixed,修复程序也被version 4.2.8向后移植到Rails 4.2:

  

大家好,

     

我很高兴地宣布Rails 4.2.8已经发布。

     

这是正式支持的4.2系列的第一个版本   Ruby 2.4。

从4.2.5到Rails 4.2.8,您需要做的只是upgrading Rails