Use date attribute for date of birth (#36039)

This commit is contained in:
Matt Jankowski
2025-11-14 10:17:53 -05:00
committed by GitHub
parent 7dbb2ac79a
commit f8ffb85566
3 changed files with 9 additions and 19 deletions

View File

@@ -131,11 +131,12 @@ class User < ApplicationRecord
delegate :can?, to: :role
attr_reader :invite_code, :date_of_birth
attr_reader :invite_code
attr_writer :current_account
attribute :external, :boolean, default: false
attribute :bypass_registration_checks, :boolean, default: false
attribute :date_of_birth, :date
def self.those_who_can(*any_of_privileges)
matching_role_ids = UserRole.that_can(*any_of_privileges).map(&:id)
@@ -151,17 +152,6 @@ class User < ApplicationRecord
Rails.env.local?
end
def date_of_birth=(hash_or_string)
@date_of_birth = begin
if hash_or_string.is_a?(Hash)
day, month, year = hash_or_string.values_at(1, 2, 3)
"#{day}.#{month}.#{year}"
else
hash_or_string
end
end
end
def role
if role_id.nil?
UserRole.everyone