diff options
Diffstat (limited to 'app/models/analytics/devops_adoption/segment.rb')
-rw-r--r-- | app/models/analytics/devops_adoption/segment.rb | 24 |
1 files changed, 0 insertions, 24 deletions
diff --git a/app/models/analytics/devops_adoption/segment.rb b/app/models/analytics/devops_adoption/segment.rb deleted file mode 100644 index 71d4a312627..00000000000 --- a/app/models/analytics/devops_adoption/segment.rb +++ /dev/null @@ -1,24 +0,0 @@ -# frozen_string_literal: true - -class Analytics::DevopsAdoption::Segment < ApplicationRecord - ALLOWED_SEGMENT_COUNT = 20 - - has_many :segment_selections - has_many :groups, through: :segment_selections - - validates :name, presence: true, uniqueness: true, length: { maximum: 255 } - validate :validate_segment_count - - accepts_nested_attributes_for :segment_selections, allow_destroy: true - - scope :ordered_by_name, -> { order(:name) } - scope :with_groups, -> { preload(:groups) } - - private - - def validate_segment_count - if self.class.count >= ALLOWED_SEGMENT_COUNT - errors.add(:name, s_('DevopsAdoptionSegment|The maximum number of segments has been reached')) - end - end -end |