class PluginValidator

Public Instance Methods

validate_each(record, attribute, value) click to toggle source
# File lib/validators/plugin_validator.rb, line 2
def validate_each(record, attribute, value)
  record.errors.add attribute, (options[:message] || validation_message) unless (allows_nil? && value.nil?) || is_valid?(value)
end

Protected Instance Methods

allows_nil?() click to toggle source
# File lib/validators/plugin_validator.rb, line 8
def allows_nil?()
  if options[:allow_nil]
    ActiveSupport::Deprecation.warn('allow_nil is depreciated in favor of the more standard allow_blank')
    return true
  elsif options[:allow_blank]
    return true
  else
    return false
  end
end
is_valid?(value) click to toggle source

Called to validate the value:

# File lib/validators/plugin_validator.rb, line 20
def is_valid?(value)
  raise NotImplementedError, 'PluginValidator is not designed to be used directly'
end
validation_message() click to toggle source

Returns the default validation message:

# File lib/validators/plugin_validator.rb, line 25
def validation_message
  raise NotImplementedError, 'PluginValidator is not designed to be used directly'
end