debian-mirror-gitlab/app/models/user_detail.rb

25 lines
630 B
Ruby
Raw Normal View History

2020-04-08 14:13:33 +05:30
# frozen_string_literal: true
class UserDetail < ApplicationRecord
2020-07-28 23:09:34 +05:30
extend ::Gitlab::Utils::Override
2021-11-11 11:23:49 +05:30
include IgnorableColumns
ignore_columns %i[bio_html cached_markdown_version], remove_with: '13.6', remove_after: '2021-10-22'
2020-07-28 23:09:34 +05:30
2020-04-08 14:13:33 +05:30
belongs_to :user
2021-09-04 01:27:46 +05:30
validates :pronouns, length: { maximum: 50 }
2021-10-27 15:23:28 +05:30
validates :pronunciation, length: { maximum: 255 }
2020-04-08 14:13:33 +05:30
validates :job_title, length: { maximum: 200 }
2020-07-28 23:09:34 +05:30
validates :bio, length: { maximum: 255 }, allow_blank: true
before_save :prevent_nil_bio
private
def prevent_nil_bio
self.bio = '' if bio_changed? && bio.nil?
end
2020-04-08 14:13:33 +05:30
end
2021-02-22 17:27:13 +05:30
2021-06-08 01:23:25 +05:30
UserDetail.prepend_mod_with('UserDetail')