Class: ValidFieldTypeValidator

Inherits:
ActiveModel::EachValidator
  • Object
show all
Defined in:
app/models/field.rb

Instance Method Summary collapse

Instance Method Details

#validate_each(record, attribute, value) ⇒ Object



2
3
4
5
# File 'app/models/field.rb', line 2

def validate_each(record, attribute, value)
  record.errors.add(attribute, "is not a valid field type.") unless
    Field.field_types.include?(record[attribute])
end