diff options
author | Akira Matsuda <ronnie@dio.jp> | 2019-07-29 14:23:10 +0900 |
---|---|---|
committer | Akira Matsuda <ronnie@dio.jp> | 2019-07-29 14:23:10 +0900 |
commit | 0196551e6039ca864d1eee1e01819fcae12c1dc9 (patch) | |
tree | 899db0e49063164697a005bca64fc5b06c2a2cfc /activemodel/lib/active_model | |
parent | 0d981a2b3d26958f19e0613db8e5f480a34dd8fc (diff) | |
download | rails-0196551e6039ca864d1eee1e01819fcae12c1dc9.tar.gz rails-0196551e6039ca864d1eee1e01819fcae12c1dc9.tar.bz2 rails-0196551e6039ca864d1eee1e01819fcae12c1dc9.zip |
Use match? where we don't need MatchData
Diffstat (limited to 'activemodel/lib/active_model')
-rw-r--r-- | activemodel/lib/active_model/validations/validates.rb | 4 |
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 # |