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.
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?
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