Method: ActiveRecord::Validations::ClassMethods#validates_numericality_of
- Defined in:
- activerecord/lib/active_record/validations/numericality.rb
#validates_numericality_of(*attr_names) ⇒ Object
Validates whether the value of the specified attribute is numeric by trying to convert it to a float with Kernel.Float (if only_integer is false) or applying it to the regular expression /\A[+\-]?\d+\z/ (if only_integer is set to true). Kernel.Float precision defaults to the column’s precision value or 15.
See ActiveModel::Validations::HelperMethods.validates_numericality_of for more information.
31 32 33 |
# File 'activerecord/lib/active_record/validations/numericality.rb', line 31 def validates_numericality_of(*attr_names) validates_with NumericalityValidator, _merge_attributes(attr_names) end |