Class: SomeValidator

Inherits:
ActiveModel::EachValidator
  • Object
show all
Defined in:
lib/errgonomic/rails/active_record_optional.rb

Overview

do we need this since we alias present below?

Instance Method Summary collapse

Instance Method Details

#validate_each(record, attribute, value) ⇒ Object



40
41
42
# File 'lib/errgonomic/rails/active_record_optional.rb', line 40

def validate_each(record, attribute, value)
  record.errors.add(attribute, 'is invalid') unless value.some?
end