Class: DataValidator::PresenceValidator

Inherits:
BaseValidator show all
Defined in:
lib/validations/presence.rb

Instance Attribute Summary

Attributes inherited from BaseValidator

#errors, #name, #options, #value

Instance Method Summary collapse

Methods inherited from BaseValidator

#add_error, #check_validity!, #initialize

Constructor Details

This class inherits a constructor from DataValidator::BaseValidator

Instance Method Details

#validateObject



5
6
7
8
9
# File 'lib/validations/presence.rb', line 5

def validate
  if options && (value.nil? || value.blank?)
    add_error :blank
  end
end