[RAILS] From the introduction of devise to the creation of the users table


## install devise

Describe at the bottom of Gemfile

gem 'devise'

`Execute command`
% bundle install
Reboot the server
% rails s
Install devise config file in rails application
	
% rails g devise:install

After execution You can create the following two files.

config/initializers/devise.rb config/locales/devise.en.yml

Create a User model

Execute the command to create a User model

	
% rails g devise user

After execution A message is displayed as shown below.

#Omission
create    db/migrate/20200523092621_devise_create_users.rb
create    app/models/user.rb

### Describe the column to be added to the users table

Write the required column (name column this time) and execute migration -Created with NOT NULL constraint that does not allow empty values

db/migrate/20XXXXXXXXXXXX_devise_create_users.rb


class DeviseCreateUsers < ActiveRecord::Migration[6.0]
  def change
    create_table :users do |t|
      ## Database authenticatable
      t.string :name,               null: false
      t.string :email,              null: false, default: ""
      t.string :encrypted_password, null: false, default: ""

      #~abridgement~
    end

Perform migration

% rails db:migrate

Restart local server after changing table / column information

Recommended Posts

From the introduction of devise to the creation of the users table
From introduction to use of ActiveHash
From introduction to usage of byebug
Output of the book "Introduction to Java"
How to write Scala from the perspective of Java
The story of migrating from Paperclip to Active Storage
Understand the characteristics of Scala in 5 minutes (Introduction to Scala)
[Rails] How to change the column name of the table
[Practice! ] Introduction of JFrame (explaining up to screen creation)
[Beginner] How to use devise Change settings from introduction
[Rails] Introduction of devise Basics
[Rails] Processing after adding a column to the devise table
The story of raising Spring Boot from 1.5 series to 2.1 series part2
Get to the abbreviations from 5 examples of iterating Java lists
[IOS] How to get the table name from AWS DynamoDB
How to get the longest information from Twitter as of 12/12/2016
[Ruby] I want to reverse the order of the hash table
Prevent other users from going to the post edit screen
I want to fetch another association of the parent model from the intermediate table with has_many
[Ruby On Rails] How to search and save the data of the parent table from the child table
Introduction to Ruby (from other languages)
From fledgling Java (3 years) to Node.js (4 years). And the impression of returning to Java
The road from JavaScript to Java
Summary about the introduction of Device
[Java] Flow from introduction of STS to confirmation of dynamic page on localhost (2/3)
[Java] Flow from introduction of STS to confirmation of dynamic page on localhost (1/3)
The story of switching from Amazon RDS for MySQL to Amazon Aurora Serverless
Confirmation and refactoring of the flow from request to controller in [httpclient]
Strict_loading function to suppress the occurrence of N + 1 problem added from rails 6.1
Iterative processing of Ruby using each method (find the sum from 1 to 10)
From Java9, the constructor of the class corresponding to primitive types is deprecated.
I translated the grammar of R and Java [Updated from time to time]
Change the half-width space of STS (Spring Tool Suite) from "u" to "・"
Introduction to Slay the Spire Mod Development (1) Introduction
[Challenge CircleCI from 0] Learn the basics of CircleCI
The secret to the success of IntelliJ IDEA
Investigate the replacement from Docker to Podman.
Introduction to java for the first time # 2
The road to Web service creation (Part 2)
[Ruby] From the basics to the inject method
How to determine the number of parallels
The story of RxJava suffering from NoSuchElementException
Ruby from the perspective of other languages
Introduction to kotlin for iOS developers ⑥-Kotlin creation
How to sort the List of SelectItem
Introduction to monitoring from Java Touching Prometheus
The process of introducing Vuetify to Rails
Find the difference from a multiple of 10
[Promotion of Ruby comprehension (1)] When switching from Java to Ruby, first understand the difference.
How to make a unique combination of data in the rails intermediate table
Learn while making a WEB server Introduction to WEB application development from the basics
How to find the cause of the Ruby error
Has the content of useBodyEncodingForURI changed from Tomcat8?
I want to output the day of the week
[Rails] Button to return to the top of the page
[Rails] Introduction of pry-rails ~ How to debug binding.pry
The road to Japaneseizing Rails devise error messages
Add empty data to the top of the list
[Docker] Introduction to docker compose Basic summary of docker-compose.yml
Customize how to divide the contents of Recyclerview
[Ruby on Rails] Until the introduction of RSpec