debian-mirror-gitlab/app/models/packages/nuget/dependency_link_metadatum.rb
2020-08-09 17:44:08 +05:30

19 lines
461 B
Ruby

# frozen_string_literal: true
class Packages::Nuget::DependencyLinkMetadatum < ApplicationRecord
self.primary_key = :dependency_link_id
belongs_to :dependency_link, inverse_of: :nuget_metadatum
validates :dependency_link, :target_framework, presence: true
validate :ensure_nuget_package_type
private
def ensure_nuget_package_type
return if dependency_link&.package&.nuget?
errors.add(:base, _('Package type must be NuGet'))
end
end