aboutsummaryrefslogtreecommitdiffstats
path: root/railties/guides/source/active_record_validations_callbacks.textile
diff options
context:
space:
mode:
authorVijay Dev <vijaydev.cse@gmail.com>2011-09-21 19:35:09 +0530
committerVijay Dev <vijaydev.cse@gmail.com>2011-09-21 19:35:09 +0530
commitcaa95ab6d826f4bb112c2911849ce03c7312af11 (patch)
tree6d64a68ba038e0be20adecfa93dedc269dfdbec8 /railties/guides/source/active_record_validations_callbacks.textile
parent95646f44fdb7cfecaac049a11b8ecef781b42d98 (diff)
parent3e80462b95808457eb1584195909e26887a1a40d (diff)
downloadrails-caa95ab6d826f4bb112c2911849ce03c7312af11.tar.gz
rails-caa95ab6d826f4bb112c2911849ce03c7312af11.tar.bz2
rails-caa95ab6d826f4bb112c2911849ce03c7312af11.zip
Merge branch 'master' of github.com:lifo/docrails
Diffstat (limited to 'railties/guides/source/active_record_validations_callbacks.textile')
-rw-r--r--railties/guides/source/active_record_validations_callbacks.textile4
1 files changed, 2 insertions, 2 deletions
diff --git a/railties/guides/source/active_record_validations_callbacks.textile b/railties/guides/source/active_record_validations_callbacks.textile
index 20f5e52891..5c3aae2955 100644
--- a/railties/guides/source/active_record_validations_callbacks.textile
+++ b/railties/guides/source/active_record_validations_callbacks.textile
@@ -328,7 +328,7 @@ This helper validates that your attributes have only numeric values. By default,
If you set +:only_integer+ to +true+, then it will use the
<ruby>
-/\A[+-]?\d+\Z/
+/\A[<plus>-]?\d<plus>\Z/
</ruby>
regular expression to validate the attribute's value. Otherwise, it will try to convert the value to a number using +Float+.
@@ -597,7 +597,7 @@ The easiest way to add custom validators for validating individual attributes is
<ruby>
class EmailValidator < ActiveModel::EachValidator
def validate_each(record, attribute, value)
- unless value =~ /\A([^@\s]+)@((?:[-a-z0-9]+\.)+[a-z]{2,})\z/i
+ unless value =~ /\A([^@\s]<plus>)@((?:[-a-z0-9]<plus>\.)+[a-z]{2,})\z/i
record.errors[attribute] << (options[:message] || "is not an email")
end
end