Initial commit

This commit is contained in:
2026-05-18 13:17:28 -04:00
committed by GitHub
commit 16fadfd529
91 changed files with 3321 additions and 0 deletions
+17
View File
@@ -0,0 +1,17 @@
class User < ApplicationRecord
# Include default devise modules. Others available are:
# :recoverable, :rememberable, :confirmable, :lockable, :timeoutable, :trackable and :omniauthable
devise :database_authenticatable, :registerable,
:validatable
# associations
has_many :blacklisted_tokens, dependent: :destroy
has_many :refresh_tokens, dependent: :destroy
# role-based authorization
enum :role, { user: 0, admin: 1, moderator: 2 }
# validations so your db doesn't turn into a trash can
validates :email, presence: true, uniqueness: true, format: { with: URI::MailTo::EMAIL_REGEXP }
validates :password, presence: true, length: { minimum: 6 }, if: -> { new_record? || !password.nil? }
end