aboutsummaryrefslogtreecommitdiffstats
path: root/activemodel/lib
diff options
context:
space:
mode:
authorXavier Noria <fxn@hashref.com>2010-08-18 00:15:01 +0200
committerXavier Noria <fxn@hashref.com>2010-08-18 00:15:01 +0200
commitea2ad26a8dc0240c40770bc1a5d3bac17ee3da8d (patch)
treee973f3b05e58e5577efa836802d53a458ca55126 /activemodel/lib
parentc924068714026ab798b16be5ee92b00b54b1f6f8 (diff)
downloadrails-ea2ad26a8dc0240c40770bc1a5d3bac17ee3da8d.tar.gz
rails-ea2ad26a8dc0240c40770bc1a5d3bac17ee3da8d.tar.bz2
rails-ea2ad26a8dc0240c40770bc1a5d3bac17ee3da8d.zip
you rarely want ^ or $ in validations, use \A when you mean \A
Diffstat (limited to 'activemodel/lib')
-rw-r--r--activemodel/lib/active_model/validations/validates.rb4
1 files changed, 2 insertions, 2 deletions
diff --git a/activemodel/lib/active_model/validations/validates.rb b/activemodel/lib/active_model/validations/validates.rb
index ba84f53e2a..f6349d57a5 100644
--- a/activemodel/lib/active_model/validations/validates.rb
+++ b/activemodel/lib/active_model/validations/validates.rb
@@ -28,7 +28,7 @@ module ActiveModel
# class EmailValidator < ActiveModel::EachValidator
# def validate_each(record, attribute, value)
# record.errors[attribute] << (options[:message] || "is not an email") unless
- # value =~ /^([^@\s]+)@((?:[-a-z0-9]+\.)+[a-z]{2,})$/i
+ # value =~ /\A([^@\s]+)@((?:[-a-z0-9]+\.)+[a-z]{2,})\z/i
# end
# end
#
@@ -48,7 +48,7 @@ module ActiveModel
#
# class TitleValidator < ActiveModel::EachValidator
# def validate_each(record, attribute, value)
- # record.errors[attribute] << "must start with 'the'" unless value =~ /^the/i
+ # record.errors[attribute] << "must start with 'the'" unless value =~ /\Athe/i
# end
# end
#