aboutsummaryrefslogtreecommitdiffstats
path: root/activemodel
diff options
context:
space:
mode:
authorAkira Matsuda <ronnie@dio.jp>2019-07-29 14:23:10 +0900
committerAkira Matsuda <ronnie@dio.jp>2019-07-29 14:23:10 +0900
commit0196551e6039ca864d1eee1e01819fcae12c1dc9 (patch)
tree899db0e49063164697a005bca64fc5b06c2a2cfc /activemodel
parent0d981a2b3d26958f19e0613db8e5f480a34dd8fc (diff)
downloadrails-0196551e6039ca864d1eee1e01819fcae12c1dc9.tar.gz
rails-0196551e6039ca864d1eee1e01819fcae12c1dc9.tar.bz2
rails-0196551e6039ca864d1eee1e01819fcae12c1dc9.zip
Use match? where we don't need MatchData
Diffstat (limited to 'activemodel')
-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 97612d474d..8906837aa8 100644
--- a/activemodel/lib/active_model/validations/validates.rb
+++ b/activemodel/lib/active_model/validations/validates.rb
@@ -27,7 +27,7 @@ module ActiveModel
# class EmailValidator < ActiveModel::EachValidator
# def validate_each(record, attribute, value)
# record.errors.add attribute, (options[:message] || "is not an email") unless
- # value =~ /\A([^@\s]+)@((?:[-a-z0-9]+\.)+[a-z]{2,})\z/i
+ # /\A([^@\s]+)@((?:[-a-z0-9]+\.)+[a-z]{2,})\z/i.match?(value)
# end
# end
#
@@ -47,7 +47,7 @@ module ActiveModel
#
# class TitleValidator < ActiveModel::EachValidator
# def validate_each(record, attribute, value)
- # record.errors.add attribute, "must start with 'the'" unless value =~ /\Athe/i
+ # record.errors.add attribute, "must start with 'the'" unless /\Athe/i.match?(value)
# end
# end
#