LoginSignup
0
0

More than 3 years have passed since last update.

【Rails】devise 導入方法

Posted at

deviseとは

  • Railsで作成したアプリケーションへ簡単に認証機能を実装することができるgem(ライブラリ)の一つ
  • ログイン、サインアップなどのログイン機能が作成出来る

導入方法

①Gemfileに追加

Gemfile
gem 'devise'

② bundle install を実行

ターミナル
$ bundle install

③設定ファイルを作成

ターミナル
$ rails g devise:install
新規作成されるファイル
config/initializers/devise.rb
config/locales/devise.en.yml

④deviseの機能を持ったUserモデルを作成

ターミナル
$ rails g devise user
新規作成されるファイル
app/models/user.rb
db/migrate/20XXXXXXXXXXXX_devise_create_users.rb
test/fixtures/users.yml
test/models/user_test.rb

⑤deviseのviewファイルを作成

ターミナル
$ rails g devise:views
新規作成されるファイル
app/views/devise #以下のディレクトリにあるビューファイル各種

これで、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