2018-06-27 12:20:23 -04:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2018-03-27 18:24:02 -04:00
|
|
|
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
|