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