gitlab-org--gitlab-foss/app/validators/top_level_group_validator.rb
2018-06-27 09:48:37 -07:00

9 lines
241 B
Ruby

# frozen_string_literal: true
class TopLevelGroupValidator < ActiveModel::EachValidator
def validate_each(record, attribute, value)
if value&.subgroup?
record.errors.add(attribute, "must be a top level Group")
end
end
end