[Rails] How to use gem "devise"

This time I learned about a gem called "devise" that I often see using rails most, so I will output it.

As for what you can understand ● What is devise in the first place? ● How to use devise?

is.

What is devise?

It is a gem that easily adds login and logout functions to web applications created with rails. devise is the most used gem and simplifies the implementation of the laborious login function.

So how do you use devise?

How to use devise

1、 gem install First, install the gem. Write devise in gemfile

gem 'devise'

2, rails g devise:install This command installs the devise config file into rails.

3, rails g devise:views Create devise files (sign up, login, etc.).

4, Create a model that you want to implement the login function with rails Create a model to authenticate (log in) with devise.

rails g devise model name

5, read migration file The last is familiar. The migration file has changed, please load it

rake db:migrate

This completes the implementation.

Recommended Posts

[Rails] How to use gem "devise"
[Rails] How to use devise (Note)
[Note] How to use Rails 6 Devise + cancancan
[Rails] How to use enum
[Rails] How to install devise
[Rails] How to use enum
How to use rails join
[Rails] How to use validation
[Rails] How to use authenticate_user!
[Rails] How to use "kaminari"
[Rails] How to use Scope
[Rails] How to use flash messages
[rails] How to use devise helper method before_action: authenticate_user!
How to use Ruby on Rails
[Rails] How to use Active Storage
[Introduction to Rails] How to use render
[Rails 5] How to use gem gon ~ How to pass variables from Rails to JS ~
How to use custom helpers in rails
[Ruby on Rails] How to use CarrierWave
[Rails] How to use rails console with docker
[Rails] How to use ActiveRecord :: Bitemporal (BiTemporalDataModel)
[Rails] How to use the map method
How to use MySQL in Rails tutorial
[Ruby on Rails] How to use redirect_to
[Ruby on Rails] How to use kaminari
[Rails] How to use video_tag to display videos
[Rails] How to use helper method, confimartion
How to use credentials.yml.enc introduced in Rails 5.2
[Rails] How to translate devise into Japanese
How to use Map
How to write Rails
How to use rbenv
How to use letter_opener_web
How to use with_option
How to use fields_for
How to use java.util.logging
How to use map
How to use collection_select
How to use Twitter4J
How to use active_hash! !!
How to use MapStruct
How to use hidden_field_tag
How to use TreeSet
How to uninstall Rails
[How to use label]
How to use identity
How to use hashes
How to use JUnit 5
How to use Dozer.mapper
How to use Gradle
How to use org.immutables
How to use java.util.stream.Collector
How to use VisualVM
How to use Map
[Rails] How to use select boxes in Ransack
How to use rails g scaffold, functions, precautions
How to use JQuery in js.erb of Rails6
[Rails] How to use Gem'rails-i18n' for Japanese support
[Ruby on Rails] How to use session method
[Rails] How to use PostgreSQL in Vagrant environment
[Java] How to use Map