Class: Tsubaki::MyNumberValidator

Inherits:
ActiveModel::EachValidator
  • Object
show all
Defined in:
lib/tsubaki/my_number_validator.rb

Instance Method Summary collapse

Instance Method Details

#validate_each(record, attribute, value) ⇒ Object



6
7
8
9
# File 'lib/tsubaki/my_number_validator.rb', line 6

def validate_each(record, attribute, value)
  return if Tsubaki::MyNumber.new(value, options).valid?
  record.errors.add(attribute, options[:message] || :invalid)
end