Thanks,
It is a part-time jobber who aims to be an engineer from inexperienced.
This time even beginners can easily
A gem famous for creating user management functions from scratch
devise
about,
While sandwiching the commentary here and there,
I would like to briefly introduce you.
First of all, let's make a rails app
rails _6.0.0_new (App name you want to make) -d mysql
(Last-d is an option, so if you don't need it, you don't have to add it.)
After installation, move to the folder you just created
Open a terminal and execute the following command
%cd (app name created by yourself)
For the time being, create a database to store the data.
Open a terminal and execute the following command
% rails db:create
Next, we will add the device gem in the Gemfile.
gem 'devise'
Don't forget to add it in Gemfile
Do a bundle install! !! (Start with rails s !!)
Then, with the terminal open Type the following command
rail g devise:install
This command will start the device to start As a personal impression, I feel the most when I hit this command lol
Don't forget to create a controller as well.
% rails g devise:controllers users
This command takes the device user-related controller Will create it at once
Because this will generate a migration file for user
Don't forget the process of sending.
rake db:migrate
And this command
rails g devise:views
All device related views at once Will make it! !!
I didn't know this at first
I wrote it all myself ...
You don't have to have that experience anymore!
It makes me feel at ease.
This is the end of the device-related command introduction!
It's so easy for anyone to create a user management function ...
The ability of gem is scary ...
I want to add sns authentication to the user registration function!
Those who say
https://developers.facebook.com/
Access the place
After registering variously,
gem 'omniauth-facebook'
If you use the gem
You can authenticate with Facebook!
(I have other things to do ...)
Why don't you take this opportunity to check it out! !!
Recommended Posts