diff options
author | CassioMarques <cassiommc@gmail.com> | 2009-01-14 22:22:56 -0200 |
---|---|---|
committer | CassioMarques <cassiommc@gmail.com> | 2009-01-14 23:51:07 -0200 |
commit | 9cc7a1e04dc99dc47d11b6303fdb011532ce19b1 (patch) | |
tree | 8c12d73341db12df68cb8082e9d9a77988451c9e /railties/doc/guides/source | |
parent | baa0ce8745611ba271b70dd4e29b4eb913387e22 (diff) | |
download | rails-9cc7a1e04dc99dc47d11b6303fdb011532ce19b1.tar.gz rails-9cc7a1e04dc99dc47d11b6303fdb011532ce19b1.tar.bz2 rails-9cc7a1e04dc99dc47d11b6303fdb011532ce19b1.zip |
Adding options for validates_numericality_of, adding author name with link at the end of the page
Diffstat (limited to 'railties/doc/guides/source')
-rw-r--r-- | railties/doc/guides/source/activerecord_validations_callbacks.txt | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/railties/doc/guides/source/activerecord_validations_callbacks.txt b/railties/doc/guides/source/activerecord_validations_callbacks.txt index 8393d183e9..849954a190 100644 --- a/railties/doc/guides/source/activerecord_validations_callbacks.txt +++ b/railties/doc/guides/source/activerecord_validations_callbacks.txt @@ -227,6 +227,17 @@ class Player < ActiveRecord::Base end ------------------------------------------------------------------ +Besides +:only_integer+, the +validates_numericality_of+ helper also accepts the following options to add constraints to acceptable values: + +* +:greater_than+ - Specifies the value must be greater than the supplied value. The default error message for this option is "_must be greater than (value)_" +* +:greater_than_or_equal_to+ - Specifies the value must be greater than or equal the supplied value. The default error message for this option is "_must be greater than or equal to (value)_" +* +:equal_to+ - Specifies the value must be equal to the supplied value. The default error message for this option is "_must be equal to (value)_" +* +:less_than+ - Specifies the value must be less than the supplied value. The default error message for this option is "_must e less than (value)_" +* +:less_than_or_equal_to+ - Specifies the value must be less than or equal the supplied value. The default error message for this option is "_must be less or equal to (value)_" +* +:odd+ - Specifies the value must be an odd number if set to true. The default error message for this option is "_must be odd_" +* +:even+ - Specifies the value must be an even number if set to true. The default error message for this option is "_must be even_" + + The default error message for +validates_numericality_of+ is "_is not a number_". === The +validates_presence_of+ helper @@ -847,4 +858,6 @@ By convention, you should always save your observers' source files inside *app/m == Changelog -http://rails.lighthouseapp.com/projects/16213/tickets/26-active-record-validations-and-callbacks +http://rails.lighthouseapp.com/projects/16213/tickets/26-active-record-validations-and-callbacks[Lighthouse ticket] + +January 9, 2009: Initial version by http://guides.rails.info/authors.html#cmarques[Cássio Marques] |