LoginSignup
18
10

More than 3 years have passed since last update.

Ruby 2.7 とRails 6.0.2.1でrailsコマンドをたたくとすごいwarningがでる

Last updated at Posted at 2020-01-31

Ruby2.7とRails6.0.2.1とpostgres12.1でDBを作るために以下のコマンドをたたくとすごいwarningがでた(処理は完了している)のでwaringを表示しないようにしてみる。

$ bundle exec rails db:create
/.rbenv/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/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
/.rbenv/gems/2.7.0/gems/activerecord-6.0.2.1/lib/active_record/type.rb:27: warning: Using the last argument as keyword parameters is deprecated; maybe ** should be added to the call
/.rbenv/gems/2.7.0/gems/activerecord-6.0.2.1/lib/active_record/type/adapter_specific_registry.rb:9: warning: The called method `add_modifåier' is defined here
/.rbenv/gems/2.7.0/gems/activemodel-6.0.2.1/lib/active_model/type/integer.rb:13: warning: Using the last argument as keyword parameters is deprecated; maybe ** should be added to the call
/.rbenv/gems/2.7.0/gems/activemodel-6.0.2.1/lib/active_model/type/value.rb:8: warning: The called method `initialize' is defined here
/.rbenv/gems/2.7.0/gems/activerecord-6.0.2.1/lib/active_record/connection_adapters/postgresql/oid/specialized_string.rb:12: warning: Using the last argument as keyword parameters is deprecated; maybe ** should be added to the call
/.rbenv/gems/2.7.0/gems/activemodel-6.0.2.1/lib/active_model/type/value.rb:8: warning: The called method `initialize' is defined here
Created database 'XXX_development'
Created database 'XXX_test'

Ruby2.7にまだ対応していないgemがあるからでているっぽい。
一旦warningがでないようにはbashprofileに環境変数を追加する。

$ vi ~/.bash_profile

bash_profileを開いてexport RUBYOPT='-W:no-deprecated -W:no-experimental'を追加するとエラーはでなくなる。

参考

https://stackoverflow.com/questions/59491848/how-to-fix-railss-warning-messages-with-ruby-2-7-0
https://tech.recruit-mp.co.jp/server-side/post-19932/

18
10
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
18
10