Class: ActiveRecord::Validations::NumericalityValidator

Inherits:
ActiveModel::Validations::NumericalityValidator
  • Object
show all
Defined in:
lib/active_record/validations/numericality.rb

Overview

:nodoc:

Instance Method Summary collapse

Instance Method Details

#validate_each(record, attribute, value, precision: nil, scale: nil) ⇒ Object



6
7
8
9
10
# File 'lib/active_record/validations/numericality.rb', line 6

def validate_each(record, attribute, value, precision: nil, scale: nil)
  precision = [column_precision_for(record, attribute) || Float::DIG, Float::DIG].min
  scale     = column_scale_for(record, attribute)
  super(record, attribute, value, precision: precision, scale: scale)
end