Skip to content

Commit

Permalink
Made admin users trackable
Browse files Browse the repository at this point in the history
  • Loading branch information
murny committed Aug 15, 2024
1 parent a33bfd0 commit 06039ad
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 11 deletions.
4 changes: 2 additions & 2 deletions app/models/admin.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
class Admin < ApplicationRecord

Check failure on line 1 in app/models/admin.rb

View workflow job for this annotation

GitHub Actions / lint

Style/FrozenStringLiteralComment: Missing frozen string literal comment.
# Include default devise modules. Others available are:
# :confirmable, :lockable, :registerable, :timeoutable, :trackable and :omniauthable
# :confirmable, :lockable, :registerable, :timeoutable, and :omniauthable
devise :database_authenticatable,
:recoverable, :rememberable, :validatable
:recoverable, :rememberable, :trackable, :validatable
end
17 changes: 8 additions & 9 deletions db/migrate/20240814221626_devise_create_admins.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,22 +4,22 @@ class DeviseCreateAdmins < ActiveRecord::Migration[7.1]
def change
create_table :admins do |t|
## Database authenticatable
t.string :email, null: false, default: ""
t.string :email, null: false, default: ""
t.string :encrypted_password, null: false, default: ""

## Recoverable
t.string :reset_password_token
t.string :reset_password_token
t.datetime :reset_password_sent_at

## Rememberable
t.datetime :remember_created_at

## 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
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
Expand All @@ -32,11 +32,10 @@ def change
# t.string :unlock_token # Only if unlock strategy is :email or :both
# t.datetime :locked_at


t.timestamps null: false
end

add_index :admins, :email, unique: true
add_index :admins, :email, unique: true

Check failure on line 38 in db/migrate/20240814221626_devise_create_admins.rb

View workflow job for this annotation

GitHub Actions / lint

Rails/BulkChangeTable: You can use `change_table :admins, bulk: true` to combine alter queries.
add_index :admins, :reset_password_token, unique: true
# add_index :admins, :confirmation_token, unique: true
# add_index :admins, :unlock_token, unique: true
Expand Down

0 comments on commit 06039ad

Please sign in to comment.