Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Ruby 2.4.1 - warning: constant ::Fixnum is deprecated [duplicate]

I'm new to StackOverflow and Rails, so I am hoping this is not too naive a question. I am trying to run my application locally using bin/rails server. When I type that, I receive the following trace:

=> 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>'

I do not believe I can ignore it as stated here (warning: constant ::Fixnum is deprecated When generating new model) because it won't open the application locally.

Could someone help?

Thank you! Ben

like image 243
benzelkin Avatar asked Jun 10 '17 17:06

benzelkin


1 Answers

Ruby 2.4 unified Fixnum and Bignum into a single class Integer. When Rails (ActiveSupport's core extensions to be precise) attempts to monkey-patch the aforementioned classes, an error occurs.

This was fixed in Rails 5, and the fix was also backported to Rails 4.2 with version 4.2.8:

Hi everyone,

I am happy to announce that Rails 4.2.8 has been released.

This is the first version of the 4.2 series that officially support Ruby 2.4.

All you have to do is upgrading Rails from 4.2.5 to Rails 4.2.8.

like image 71
Stefan Avatar answered Nov 02 '22 10:11

Stefan