Class: Dis::Validations::DataPresence
- Inherits:
-
ActiveModel::Validator
- Object
- ActiveModel::Validator
- Dis::Validations::DataPresence
- Defined in:
- lib/dis/validations/data_presence.rb
Overview
Dis Data Presence Validation
Instance Method Summary collapse
-
#validate(record) ⇒ Object
Validates that a record has data, either freshly assigned or persisted in the storage.
Instance Method Details
#validate(record) ⇒ Object
Validates that a record has data, either freshly assigned or persisted in the storage. Adds a ‘:blank` error on `:data`if not.
10 11 12 13 14 |
# File 'lib/dis/validations/data_presence.rb', line 10 def validate(record) unless record.data? record.errors.add(:data, :blank) end end |