Class: ActiveModel::Validations::ResourceNameValidator

Inherits:
EachValidator
  • Object
show all
Defined in:
lib/active_model/validations/resource_name_validator.rb

Instance Method Summary collapse

Instance Method Details

#validate_each(record, attribute, value) ⇒ Object



8
9
10
11
12
# File 'lib/active_model/validations/resource_name_validator.rb', line 8

def validate_each(record, attribute, value)
  if resource_patterns.include? value
    record.errors.add(attribute, :is_reserved || 'is reserved.')
  end
end