Module DataMapper::Validations::ValidatesNumericality
In: lib/dm-validations/validators/numeric_validator.rb

Methods

Public Instance methods

Validate whether a field is numeric

Options are:

:allow_nil => true | false

  true if number can be nil, false if not

:allow_blank => true | false

  true if number can be blank, false if not

:message => "Error message for %s"

  Custom error message, also can be a callable object that takes
  an object (for pure Ruby objects) or object and property (for DM resources)

:precision => 2

  Required precision of a value

:scale => 2

  Required scale of a value

:gte => 5.75

  'Greater than or greater' requirement

:lte => 5.75

  'Less than or greater' requirement

:lt => 5.75

  'Less than' requirement

:gt => 5.75

  'Greater than' requirement

:eq => 5.75

  'Equal' requirement

:ne => 5.75

  'Not equal' requirement

:integer_only => true

  Use to restrict allowed values to integers

[Validate]