LoginSignup
0
0

More than 1 year has passed since last update.

ログイン機能を実装中(自分でログインできない)

Posted at

ログイン機能を実装中(自分でログインできない)

シードファイル
rails db:seed
テーブルのサンプル読み込みの役割

bundle exec rake db:seed
を行ってからログインする

シードファイル
rails db:seed
テーブルのサンプル読み込みの役割
を忘れていた。

seedデータとは
初期データやテストデータのことで動作確認用データを登録する目的で行います。投入したいデータの件数が増えた場合にもこれさえあれば迅速に投入できる環境を構築することができます。
seedデータの投入
下記コマンドを実行します。

rake db:seed
dockerを使用している場合
docker-compose exec web bundle exec rake db:seed
をおこなえば良い。

ファイルにgemを入れる
bundle install

テーブルの作成
rails db:create

マイグレーションを実行
rails db:migrate

テストの実装
rake db:seed

の流れ

❯ bundle exec rake db:seed
を叩いたところ解決しました。

0
0
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
0
0