プログラミング初学者なしこの技術アウトプット

プログラミングスクールRUNTEQで学んだことや自習したことのアウトプットをするブログ

rails g controller 実行時にDeprecation Warningになった場合の解決法

ActionMailerでメイラーの生成をするためにRailsガイドに従ってbundle exec rails g mailer UserMailerをしたらDeprecation warningが出ました。 他のrails gコマンドでも同様の事象が起きました。

警告の内容
Deprecation warning: Expected string default value for '--test-framework'; got false (boolean).
This will be rejected in the future unless you explicitly pass the options `check_default_type: false` or call `allow_incompatible_default_type!` in your code
You can silence deprecations warning by setting the environment variable THOR_SILENCE_DEPRECATION.

以下の記事を参考に、解決ができました!
rails g controller 実行時にDeprecation Warningになった。その対処法。

  1. Gemfileにgem 'thor', '0.19.1'を追加

  2. bundle update thorを実行

簡単でした! 記事によると、結構前からある事象らしく、ジェネレータに関係のあるthor gemのバージョンが関係していて、'0.19.1'`にダウングレードすることで表示されなくなるみたいです。