diff options
Diffstat (limited to 'app/models/concerns/packages/debian/architecture.rb')
-rw-r--r-- | app/models/concerns/packages/debian/architecture.rb | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/app/models/concerns/packages/debian/architecture.rb b/app/models/concerns/packages/debian/architecture.rb new file mode 100644 index 00000000000..4aa633e0357 --- /dev/null +++ b/app/models/concerns/packages/debian/architecture.rb @@ -0,0 +1,25 @@ +# frozen_string_literal: true + +module Packages + module Debian + module Architecture + extend ActiveSupport::Concern + + included do + belongs_to :distribution, class_name: "Packages::Debian::#{container_type.capitalize}Distribution", inverse_of: :architectures + + validates :distribution, + presence: true + + validates :name, + presence: true, + length: { maximum: 255 }, + uniqueness: { scope: %i[distribution_id] }, + format: { with: Gitlab::Regex.debian_architecture_regex } + + scope :with_distribution, ->(distribution) { where(distribution: distribution) } + scope :with_name, ->(name) { where(name: name) } + end + end + end +end |