Rails śledzony do opracowania
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
Benedict Ouma