2018-11-08 19:23:39 +05:30
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2018-05-09 12:01:36 +05:30
|
|
|
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
|