0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

【Rails】ユーザー管理機能をDeviseを使って実装する方法

Last updated at Posted at 2021-05-11

1: Gemのインストール

Gemfile
# 最下部に追記
gem 'devise'
```
 
```terminal:ターミナル
% bundle install

# 再起動
control + C
rails s
```
2: deviseの設定ファイルを作成

```terminal:ターミナル
% rails g devise:install
```

3: userモデルを生成

```terminal:ターミナル
% rails g devise user
```
4: マイグレーションの実行

```
#db/migrate/20XXXXXXXXX_devise_create_users.rb に記述

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

# usersテーブルを確認

# ターミナルにて
再起動
control + C
rails s

# localhost:3000 で確認
```

5: deviseのビューを作成

```terminal:ターミナル
rails g devise:views

# ログイン画面・サインアップ画面を編集
```

以上がdeviseを使ってユーザー管理機能を実装する方法でした!
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

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?