LoginSignup
0
0

More than 3 years have passed since last update.

[rails]deviseでのログイン画面実装

Last updated at Posted at 2020-08-01

deviseでのログイン画面実装

1.Gemfileに「gem 'devise'」を追加

gem 'devise'

2.追加したdeviseを、アプリケーションに読み込ませる。
※gemを追加した時に忘れてはいけない

$ bundle install

3.deviseの初期設定

$ rails g devise:install

これでdeviseを使う準備は完了。

4.Userモデルとマイグレーションファイルを作成
rails g devise モデル名の記述は、devise独自のルールです。

$ rails g devise User

5.データベースへ反映
新しくUserテーブルをデータベースへ反映させます。

$ rails db:migrate

6.deivse用のログイン画面を作成

$ rails g devise:views

7.rails s -b 0.0.0.0でサーバー起動させ、画面確認

image.png

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