diff --git a/railties/doc/guides/html/activerecord_validations_callbacks.html b/railties/doc/guides/html/activerecord_validations_callbacks.html index 61ccbbc1ca..0106c6fc38 100644 --- a/railties/doc/guides/html/activerecord_validations_callbacks.html +++ b/railties/doc/guides/html/activerecord_validations_callbacks.html @@ -602,7 +602,7 @@ http://www.gnu.org/software/src-highlite -->

The validates_size_of helper is an alias for validates_length_of.

2.8. The validates_numericality_of helper

This helper validates that your attributes have only numeric values. By default, it will match an optional sign followed by a integral or floating point number. Using the :integer_only option set to true, you can specify that only integral numbers are allowed.

-

If you set :integer_only to true, then it will use the /\A[+\-]?\d+\Z/+ regular expression to validate the attribute’s value. Otherwise, it will try to convert the value to a number using +Kernel.Float.

+

If you set :integer_only to true, then it will use the $$/\A[\-]?\d+\Z/ regular expression to validate the attribute’s value. Otherwise, it will try to convert the value to a number using +Kernel.Float.

class Player < ActiveRecord::Base
   validates_numericality_of :points
-  validates_numericality_of :games_played, :integer_only => true
+  validates_numericality_of :games_played, :only_integer => true
 end

Besides :only_integer, the validates_numericality_of helper also accepts the following options to add constraints to acceptable values: