warning: constant ::Fixnum is deprecated When generating new model

后端 未结 5 1282
无人共我
无人共我 2020-12-04 14:47

I\'ve tried to find some solution for this, but I really couldn\'t find anything related with the errors that is appearing to me when I run the rails command:

相关标签:
5条回答
  • 2020-12-04 15:32

    I fixed this updating therubyracer gem from version '0.12.2' to '0.12.3'

    0 讨论(0)
  • 2020-12-04 15:34

    This warnings appear because you are using ruby 2.4.0.

    This version introduced this change: Unify Fixnum and Bignum into Integer

    See here for the announcement: https://www.ruby-lang.org/en/news/2016/12/25/ruby-2-4-0-released/

    The warnings come from the activesupport gem which is part of rails and will be fixed in an upcoming release.

    For now you can just ignore those warnings.

    Update: Rails 5.0.2 has been released, which gets rid of the warnings.

    0 讨论(0)
  • 2020-12-04 15:39

    I fixed mine by updating rails

    bundle update rails
    
    0 讨论(0)
  • 2020-12-04 15:44

    I assume you're using Rails 5? Check out this link (towards the bottom). Looks like these warnings will go away with release #27458.

    0 讨论(0)
  • 2020-12-04 15:48

    If these deprecation warnings in active support are the only warnings you are seeing, you can surpress them by passing a RUBYOPT bash variable with the -W0 option which will silence.

    so instead of rails server try: RUBYOPT="-W0" rails server or RUBYOPT="-W0" bin/rails server

    In rails 5.0 you may want to get in the habit of using bin/rails not just rails, since that's the global rails version which may or may not be the same as your local rails version.

    0 讨论(0)
提交回复
热议问题