aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test/models
diff options
context:
space:
mode:
authorlulalala <mark@goodlife.tw>2018-03-31 22:42:40 +0800
committerlulalala <mark@goodlife.tw>2019-03-31 22:59:12 +0800
commitabee0343686b476139c476952b1c68f1fba6b3d0 (patch)
treecbc584a71167a90179a4c9515c69084f49cb3d28 /activerecord/test/models
parent67d262f70f47154b2476b5fcadf21dd63ebc2597 (diff)
downloadrails-abee0343686b476139c476952b1c68f1fba6b3d0.tar.gz
rails-abee0343686b476139c476952b1c68f1fba6b3d0.tar.bz2
rails-abee0343686b476139c476952b1c68f1fba6b3d0.zip
Raise deprecation for calling `[:f] = 'b'` or `[:f] << 'b'`
Revert some tests to ensure back compatibility
Diffstat (limited to 'activerecord/test/models')
-rw-r--r--activerecord/test/models/reply.rb12
1 files changed, 6 insertions, 6 deletions
diff --git a/activerecord/test/models/reply.rb b/activerecord/test/models/reply.rb
index b35623a344..f6ab9c8a8f 100644
--- a/activerecord/test/models/reply.rb
+++ b/activerecord/test/models/reply.rb
@@ -34,29 +34,29 @@ class WrongReply < Reply
validate :check_author_name_is_secret, on: :special_case
def check_empty_title
- errors[:title] << "Empty" unless attribute_present?("title")
+ errors.add(:title, "Empty") unless attribute_present?("title")
end
def errors_on_empty_content
- errors[:content] << "Empty" unless attribute_present?("content")
+ errors.add(:content, "Empty") unless attribute_present?("content")
end
def check_content_mismatch
if attribute_present?("title") && attribute_present?("content") && content == "Mismatch"
- errors[:title] << "is Content Mismatch"
+ errors.add(:title, "is Content Mismatch")
end
end
def title_is_wrong_create
- errors[:title] << "is Wrong Create" if attribute_present?("title") && title == "Wrong Create"
+ errors.add(:title, "is Wrong Create") if attribute_present?("title") && title == "Wrong Create"
end
def check_wrong_update
- errors[:title] << "is Wrong Update" if attribute_present?("title") && title == "Wrong Update"
+ errors.add(:title, "is Wrong Update") if attribute_present?("title") && title == "Wrong Update"
end
def check_author_name_is_secret
- errors[:author_name] << "Invalid" unless author_name == "secret"
+ errors.add(:author_name, "Invalid") unless author_name == "secret"
end
end