debian-mirror-gitlab/app/models/ml/candidate_metadata.rb
2023-07-09 08:55:56 +05:30

14 lines
440 B
Ruby

# frozen_string_literal: true
module Ml
class CandidateMetadata < ApplicationRecord
validates :candidate, presence: true
validates :name,
length: { maximum: 250 },
presence: true,
uniqueness: { scope: :candidate, message: ->(candidate, _) { "'#{candidate.name}' already taken" } }
validates :value, length: { maximum: 5000 }, presence: true
belongs_to :candidate, class_name: 'Ml::Candidate'
end
end