LoginSignup
13

More than 3 years have passed since last update.

【console】rails c RAILS_ENV=testは廃止予定なのでrails c -e testを使う

Last updated at Posted at 2019-06-15

はじめてのQiita記事投稿になります。ものっそい緊張しております。

概要

Railsで個人開発をしているときにRSpecを書こうとしたときの話です

FactoryBotなどの挙動をtest環境のconsoleで確認しようと思い、

rails c RAILS_ENV=test

と打ったのですが、ここでメッセージが。

DEPRECATION WARNING: Passing the environment's name as a regular argument is 
deprecated and will be removed in the next Rails version. Please, use the -e
option instead.

要は環境の名前を変数として渡すのはアレなので-eオプションを使ってね!ってこと。

解決策

rails c -e test

とすればWARNINGも出ない。問題解決!

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
13