Fix account page forms & add account actions rspec
All checks were successful
CI / scan_ruby (push) Successful in 21s
CI / scan_js (push) Successful in 13s
CI / lint (push) Successful in 13s
CI / test (push) Successful in 37s

#5
This commit is contained in:
sto
2025-12-10 10:44:03 +01:00
parent cce090587a
commit 8cea403dc9
12 changed files with 131 additions and 47 deletions

View File

@@ -2,14 +2,15 @@
#
# 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
# id :integer not null, primary key
# admin :boolean default(FALSE), not null
# email_address :string not null
# lang :string default("en")
# password_change_attempt :boolean
# password_digest :string not null
# username :string
# created_at :datetime not null
# updated_at :datetime not null
#
# Indexes
#
@@ -25,4 +26,5 @@ class User < ApplicationRecord
validates :username, presence: true, uniqueness: true
validates :email_address, presence: true, uniqueness: true
validates :lang, inclusion: { in: Languages::AVAILABLE_LANGUAGES.map { |lang| lang[:id] } }
validates :password, presence: true, if: -> { password_change_attempt }
end