debian-mirror-gitlab/app/models/ml/candidate_metric.rb

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

13 lines
363 B
Ruby
Raw Normal View History

2022-08-27 11:52:29 +05:30
# frozen_string_literal: true
module Ml
class CandidateMetric < ApplicationRecord
validates :candidate, presence: true
validates :name, length: { maximum: 250 }, presence: true
belongs_to :candidate, class_name: 'Ml::Candidate'
2023-01-13 00:05:48 +05:30
scope :latest, -> { select('DISTINCT ON (candidate_id, name) *').order('candidate_id, name, id DESC') }
2022-08-27 11:52:29 +05:30
end
end