Class: ValidatesStructure::Validator::NotNilValidator

Inherits:
ActiveModel::EachValidator
  • Object
show all
Defined in:
lib/validates-structure.rb

Instance Method Summary collapse

Instance Method Details

#validate_each(record, attribute, value) ⇒ Object



144
145
146
147
148
# File 'lib/validates-structure.rb', line 144

def validate_each(record, attribute, value)
  if value.nil?
    record.errors.add attribute, "must not be nil"
  end
end