summaryrefslogtreecommitdiff
path: root/app/validators/top_level_group_validator.rb
blob: b50c9dca154f2ac9b6dc3e7f3c5229f4e370ea5f (plain)
1
2
3
4
5
6
7
8
9
# 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