sto 8d754ec7aa
Some checks failed
CI / scan_ruby (push) Successful in 15s
CI / scan_js (push) Successful in 12s
CI / lint (push) Successful in 12s
CI / test (push) Failing after 36s
Add language settings for users, and translate titles to French
2025-03-27 12:54:03 +01:00

28 lines
858 B
Ruby

# == Schema Information
#
# Table name: users
#
# id :integer not null, primary key
# admin :boolean default(FALSE), not null
# email_address :string not null
# lang :string default("en")
# password_digest :string not null
# username :string
# created_at :datetime not null
# updated_at :datetime not null
#
# Indexes
#
# index_users_on_email_address (email_address) UNIQUE
#
class User < ApplicationRecord
has_many :contests, dependent: :destroy
has_many :sessions, dependent: :destroy
has_secure_password
normalizes :email_address, with: ->(e) { e.strip.downcase }
validates :username, presence: true, uniqueness: true
validates :lang, inclusion: { in: Languages::AVAILABLE_LANGUAGES.map { |lang| lang[:id] } }
end