Class/Module Index [+]

Quicksearch

DataMapper::Validations::ValidatesNumericality

Public Instance Methods

validates_numericality_of(*fields) click to toggle source

Validate whether a field is numeric.

@option [Boolean] :allow_nil

true if number can be nil, false if not.

@option [Boolean] :allow_blank

true if number can be blank, false if not.

@option [String] :message

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

@option [Numeric] :precision

Required precision of a value.

@option [Numeric] :scale

Required scale of a value.

@option [Numeric] :gte

'Greater than or equal to' requirement.

@option [Numeric] :lte

'Less than or equal to' requirement.

@option [Numeric] :lt

'Less than' requirement.

@option [Numeric] :gt

'Greater than' requirement.

@option [Numeric] :eq

'Equal' requirement.

@option [Numeric] :ne

'Not equal' requirement.

@option [Boolean] :integer_only

Use to restrict allowed values to integers.
# File lib/dm-validations/validators/numeric_validator.rb, line 175
def validates_numericality_of(*fields)
  validators.add(NumericalityValidator, *fields)
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.