mirror of
https://github.com/LaCasemate/fab-manager.git
synced 2025-02-19 13:54:25 +01:00
validate birth date must be in the past
This commit is contained in:
parent
351360bfa2
commit
e9740ebf69
@ -28,6 +28,8 @@ class StatisticProfile < ApplicationRecord
|
||||
# Projects that the current user is the author
|
||||
has_many :my_projects, foreign_key: :author_statistic_profile_id, class_name: 'Project', dependent: :destroy
|
||||
|
||||
validates :check_birthday_in_past
|
||||
|
||||
def str_gender
|
||||
gender ? 'male' : 'female'
|
||||
end
|
||||
@ -40,4 +42,10 @@ class StatisticProfile < ApplicationRecord
|
||||
''
|
||||
end
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def check_birthday_in_past
|
||||
errors.add(:birthday, I18n.t('statistic_profile.birthday_in_past')) if birthday.present? && birthday > DateTime.current
|
||||
end
|
||||
end
|
||||
|
@ -418,6 +418,8 @@ en:
|
||||
admins: 'Administrators'
|
||||
cart_items:
|
||||
free_extension: "Free extension of a subscription, until %{DATE}"
|
||||
statistic_profile:
|
||||
birthday_in_past: "The date of birth must be in the past"
|
||||
settings:
|
||||
locked_setting: "the setting is locked."
|
||||
about_title: "\"About\" page title"
|
||||
|
Loading…
x
Reference in New Issue
Block a user