GENERATE HOME CONTROLLER
rails generate controller Home index error

INSTALL DEVISE
rails generate devise:install

GENERATE USER WITH ROLE AND STATUS
rails generate devise User name role:integer status:integer


# UPDATE MIGRATION FILE WITH DEFAULT VALUES FOR ROLE AND STATUS
      # t.integer :role, null: false, default: 0
      # t.integer :status, null: false, default: 0

# UNCOMMENT TRACKABLE AND CONFIRMABLE SECTION
      # # Trackable
      # t.integer  :sign_in_count, default: 0, null: false
      # t.datetime :current_sign_in_at
      # t.datetime :last_sign_in_at
      # t.string   :current_sign_in_ip
      # t.string   :last_sign_in_ip

      # # Confirmable
      # t.string   :confirmation_token
      # t.datetime :confirmed_at
      # t.datetime :confirmation_sent_at

      # add_index :users, :confirmation_token,   unique: true


RUN MIGRATION
rails db:migrate

UPDATE USER MODEL (UNCOMMENT :CONFIRMABLE AND :TRACKABLE)

GENERATE VIEWS
rails generate devise:views

ADD NAME TO APP/VIEWS/DEVISE/REGISTRATION/NEW.HTML.ERB
  <div class="field">
    <%= f.label :name %><br />
    <%= f.text_field :name, autofocus: true, autocomplete: "name" %>
  </div>

ADD NAME TO APP/VIEWS/DEVISE/REGISTRATION/EDIT.HTML.ERB
  <div class="field">
    <%= f.label :name %><br />
    <%= f.text_field :name, autofocus: true, autocomplete: "name" %>
  </div>

UPDATE ROUTES.RB
root "home#index"
devise_for :users, controllers: { confirmations: 'confirmations' }

UPDATE CONFIG/ENVIRONMENTS/DEVELOPMENT.RB
config.action_mailer.default_url_options = {host: 'localhost:3000'}

UPDATE CONFIG/INITIALIZERS/DEVISE.RB (SET TO FALSE)
config.reconfirmable = false

UPDATE HOME/INDEX.HTML.ERB

<center><h3>Homepage</h3></center>
<br>

<% if user_signed_in?%>
      <center>
            <%= current_user.email%>
            <br>
            <%= button_to "Sign Out", destroy_user_session_path, method: :delete%>
      </center>
<%else%>
      <center>
            <%= link_to "Sign In", new_user_session_path %>&nbsp | &nbsp
            <%= link_to "Sign Up", new_user_registration_path %>
      </center>
<%end%>



INSTALL DOORKEPPER

gem "doorkeeper", "~> 5.6"

# INSTALL DOORKEEPER
rails g doorkeeper:install

# CREATE CONFIG/INITIALIZERS/DOORKEEPER
touch "config/initializers/doorkeeper.rb"

# ADD CONTENT
Doorkeeper.configure do
  orm :active_record

  resource_owner_from_credentials do
    User.authenticate(params[:email], params[:password])
  end

  grant_flows %w[password]

  use_refresh_token

  allow_blank_redirect_uri true

  skip_authorization do 
    true
  end
end