Search
 
SCRIPT & CODE EXAMPLE
 

RUBY

rails trackable to devise

rails generate migration AddDeviseTrackableColumnsToUsers

# /db/migrate
class AddDeviseTrackableColumnsToUsers < ActiveRecord::Migration[6.1]
  def change
    add_column :users, :sign_in_count, :integer, default: 0, null: false
    add_column :users, :current_sign_in_at, :datetime
    add_column :users, :last_sign_in_at, :datetime
    add_column :users, :current_sign_in_ip, :string
    add_column :users, :last_sign_in_ip, :string
  end
end


# app/models/user.rb
class User < ApplicationRecord
  # Include default devise modules. Others available are:
  # :registerable, :recoverable, :rememberable, :validatable, :confirmable,
  # :lockable, :timeoutable, :trackable and :omniauthable
  devise :database_authenticatable, :trackable
end
Comment

PREVIOUS NEXT
Code Example
Ruby :: dotenv-rails comments 
Ruby :: microsoft office 2016 txt file activator 
Ruby :: get current year in ruby 
Ruby :: ruby hash map key value 
Ruby :: fibonacci sums ruby 
Ruby :: rails routes grep 
Ruby :: ruby delete folder recursively 
Ruby :: ruby attr_accessor multiple variables 
Ruby :: run a specific migration rails 
Ruby :: add timezone in rails 
Ruby :: how to force exit server in rails 
Ruby :: ruby string to int 
Ruby :: how to destroy a migration in rails 
Ruby :: auto load path rails 
Ruby :: rails resources only 
Ruby :: ruby remove last element of string 
Ruby :: rails route list 
Ruby :: rails scope syntax 
Ruby :: rails secure uuid 
Ruby :: dictionary ruby 
Ruby :: ruby array shift 
Ruby :: ruby division floating decimal 
Ruby :: ruby frozen_string_literal 
Ruby :: rails include module 
Ruby :: add elements to ruby hashes 
Ruby :: intermediate rails project 
Ruby :: rails g sessions controller in rails 
Ruby :: include? reverse ruby 
Ruby :: question mark in ruby 
Ruby :: rails decode cookie 
ADD CONTENT
Topic
Content
Source link
Name
1+8 =