Class: Validaty::Base

Inherits:
ActiveModel::EachValidator
  • Object
show all
Defined in:
lib/validaty/base.rb

Direct Known Subclasses

BooleanValidator, AllowBlankBase

Instance Method Summary collapse

Instance Method Details

#validate_each(resource, attribute, value) ⇒ Object



3
4
5
6
7
8
9
# File 'lib/validaty/base.rb', line 3

def validate_each(resource, attribute, value)
  resource, attribute, value = prepare_params(resource, attribute, value)

  return if valid_value?(value)

  resource.errors.add(attribute, (options[:message] || default_message_error))
end