Search
 
SCRIPT & CODE EXAMPLE
 

RUBY

devise add trackable

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 :: run rake task in rails console 
Ruby :: ruby current date and time 
Ruby :: rspec check if object of a class 
Ruby :: rails generate model polymorphic references 
Ruby :: integer to string ruby 
Ruby :: in query postgres jsonb rails 
Ruby :: ruby get file name 
Ruby :: rails validators 
Ruby :: how to down a particular migration in rails 
Ruby :: max keys from hash ruby 
Ruby :: ruby each char with index 
Ruby :: rails datatypes 
Ruby :: rails order 
Ruby :: rails migration add default value 
Ruby :: ruby test is number 
Ruby :: ruby sort array numerically 
Ruby :: ruby loop through array 
Ruby :: rails setup test db 
Ruby :: rails add index specifc name 
Ruby :: rails server stop pid 
Ruby :: arel_table rails 
Ruby :: rails retrieve database.yml 
Ruby :: ruby abs function programming 
Ruby :: resources rails 
Ruby :: online ruby compiler 
Ruby :: ruby prepend string 
Ruby :: find_by column name rails route 
Ruby :: rails date field default today 
Ruby :: rails has_many through source 1 
Ruby :: cloudbuild ruby googl 
ADD CONTENT
Topic
Content
Source link
Name
2+2 =