警告:constant ::Fixnum is deprecated 生成新模型时 [英] warning: constant ::Fixnum is deprecated When generating new model

查看:175
本文介绍了警告:constant ::Fixnum is deprecated 生成新模型时的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图为此找到一些解决方案,但我真的找不到与运行 rails 命令时出现的错误相关的任何内容:

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:

rails 生成模型书名:字符串摘要:文本 isbn:字符串

rails generate model Book title:string summary:text isbn:string

/home/vmu/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/activesupport-5.0.1/lib/active_support/xml_mini.rb:51: warning: constant ::Fixnum is deprecated
/home/vmu/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/activesupport-5.0.1/lib/active_support/xml_mini.rb:52: warning: constant ::Bignum is deprecated
/home/vmu/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/activesupport-5.0.1/lib/active_support/core_ext/numeric/conversions.rb:138: warning: constant ::Fixnum is deprecated
Running via Spring preloader in process 3579
Expected string default value for '--jbuilder'; got true (boolean)
      invoke  active_record
   identical    db/migrate/20170104114702_create_books.rb
   identical    app/models/book.rb
      invoke    test_unit
   identical      test/models/book_test.rb
   identical      test/fixtures/books.yml

有人知道导致这些错误的原因是什么吗?

Anyone know what may be causing these errors?

推荐答案

出现此警告是因为您使用的是 ruby​​ 2.4.0.

This warnings appear because you are using ruby 2.4.0.

这个版本引入了这个变化:统一Fixnum和Bignum成整数

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

请参阅此处的公告:https://www.ruby-lang.org/en/news/2016/12/25/ruby-2-4-0-released/

警告来自 activesupport gem,它是 rails 的一部分,将在即将发布的版本中修复.

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.

更新: Rails 5.0.2 已经发布,消除了警告.

这篇关于警告:constant ::Fixnum is deprecated 生成新模型时的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆