From abee0343686b476139c476952b1c68f1fba6b3d0 Mon Sep 17 00:00:00 2001 From: lulalala Date: Sat, 31 Mar 2018 22:42:40 +0800 Subject: Raise deprecation for calling `[:f] = 'b'` or `[:f] << 'b'` Revert some tests to ensure back compatibility --- activemodel/test/validators/email_validator.rb | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'activemodel/test/validators') diff --git a/activemodel/test/validators/email_validator.rb b/activemodel/test/validators/email_validator.rb index 0c634d8659..774a10b2ba 100644 --- a/activemodel/test/validators/email_validator.rb +++ b/activemodel/test/validators/email_validator.rb @@ -2,7 +2,8 @@ class EmailValidator < ActiveModel::EachValidator def validate_each(record, attribute, value) - record.errors[attribute] << (options[:message] || "is not an email") unless - /\A([^@\s]+)@((?:[-a-z0-9]+\.)+[a-z]{2,})\z/i.match?(value) + unless /\A([^@\s]+)@((?:[-a-z0-9]+\.)+[a-z]{2,})\z/i.match?(value) + record.errors.add(attribute, message: options[:message] || "is not an email") + end end end -- cgit v1.2.3