diff options
author | CassioMarques <cassiommc@gmail.com> | 2009-01-15 00:50:47 -0200 |
---|---|---|
committer | CassioMarques <cassiommc@gmail.com> | 2009-01-15 00:50:47 -0200 |
commit | 51460808cd1f0beaec8d862dc6ee8ca8aad27ed6 (patch) | |
tree | 93aec7090db5b379d05eaedbd0d2857aa3dd4ecf /railties/doc/guides/source/activerecord_validations_callbacks.txt | |
parent | 301b2fefaa6d6527af7312ac6ffedcc989f66512 (diff) | |
download | rails-51460808cd1f0beaec8d862dc6ee8ca8aad27ed6.tar.gz rails-51460808cd1f0beaec8d862dc6ee8ca8aad27ed6.tar.bz2 rails-51460808cd1f0beaec8d862dc6ee8ca8aad27ed6.zip |
Small modifications in the text of the section about using the errors collection in the view, fixed a typo at the validates_numericality_of section
Diffstat (limited to 'railties/doc/guides/source/activerecord_validations_callbacks.txt')
-rw-r--r-- | railties/doc/guides/source/activerecord_validations_callbacks.txt | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/railties/doc/guides/source/activerecord_validations_callbacks.txt b/railties/doc/guides/source/activerecord_validations_callbacks.txt index c864b91498..8bfb69ea99 100644 --- a/railties/doc/guides/source/activerecord_validations_callbacks.txt +++ b/railties/doc/guides/source/activerecord_validations_callbacks.txt @@ -217,7 +217,7 @@ The +validates_size_of+ helper is an alias for +validates_length_of+. 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+. [source, ruby] ------------------------------------------------------------------ @@ -542,7 +542,7 @@ p.errors.on(:name) == Using the +errors+ collection in your view templates -Rails provides built-in helpers to display the error messages of your models in your view templates. It may be useful to display those messages when you're trying to create or edit a record and validation fails. If you're using the +form_for+ helper to create a form, you can use it to call the +error_messages+ method, which creates a +div+ element containing all the error messages for the model associated with the form. Here is a simple example, using a +Product+ model and the view template generated with the scaffold script. +Rails provides built-in helpers to display the error messages of your models in your view templates. When creating a form with the form_for helper, you can use the error_messages method on the form builder to render all failed validation messages for the current model instance. [source, ruby] ------------------------------------------------------------------ |