有人解决过 Ruby 2.7.0
的这个问题吗?
我使用了 rbenv
安装了 Ruby v2.7.0,然后使用 Rails v6.0.2.1
创建了一个 Rails 项目。
目前,通过运行以下命令之一:
rails s
rails s -u puma
rails s -u webrick
服务器已开启并提供了网站服务,但在控制台
日志中我看到两条警告信息:
local:~/rcode/rb27$ rails s
=> Booting Puma
=> Rails 6.0.2.1 application starting in development
=> Run `rails server --help` for more startup options
.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/actionpack-6.0.2.1/lib/action_dispatch/middleware/stack.rb:37: warning: Using the last argument as keyword parameters is deprecated; maybe ** should be added to the call
.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/actionpack-6.0.2.1/lib/action_dispatch/middleware/static.rb:110: warning: The called method `initialize' is defined here
Puma starting in single mode...
* Version 4.3.1 (ruby 2.7.0-p0), codename: Mysterious Traveller
* Min threads: 5, max threads: 5
* Environment: development
* Listening on tcp://127.0.0.1:3000
* Listening on tcp://[::1]:3000
所以,警告信息为:**.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/actionpack-6.0.2.1/lib/action_dispatch/middleware/stack.rb:37: warning: Using the last argument as keyword parameters is deprecated; maybe ** should be added to the call**
**.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/actionpack-6.0.2.1/lib/action_dispatch/middleware/static.rb:110: warning: The called method `initialize' is defined here**
我看到了 这个链接,其中提出了一些建议,例如关闭警告,如“如果您想禁用弃用警告,请使用命令行参数-W:no-deprecated或将Warning [:deprecated] = false添加到您的代码中。” 不过,我正在考虑一个更好的解决方案/修复方法,适用于actionpack v6.0.2.1。