Methods

Class/Module Index [+]

Quicksearch

DataMapper::Validations::AbsenceValidator

@author Guy van den Berg @since 0.9

Public Instance Methods

call(target) click to toggle source
# File lib/dm-validations/validators/absent_field_validator.rb, line 8
def call(target)
  value = target.validation_property_value(field_name)
  return true if DataMapper::Ext.blank?(value)

  error_message = (
    self.options[:message] || ValidationErrors.default_error_message(
      :absent, field_name
    )
  )

  add_error(target, error_message, field_name)
  false
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.