models: fix deprecated errors[:base] << "message" calls.

Replace the idiom `errors[:base] << "message"` with
`errors.add(:base, "message")`. The former is deprecated in Rails 6.1.
This commit is contained in:
evazion
2020-12-13 04:00:32 -06:00
parent 62b69eb133
commit 8d87b1a0c0
29 changed files with 108 additions and 109 deletions

View File

@@ -28,11 +28,11 @@ class PostAppeal < ApplicationRecord
extend SearchMethods
def validate_creator_is_not_limited
errors[:creator] << "have reached your appeal limit" if creator.is_appeal_limited?
errors.add(:creator, "have reached your appeal limit") if creator.is_appeal_limited?
end
def validate_post_is_appealable
errors[:post] << "cannot be appealed" if post.is_status_locked? || !post.is_appealable?
errors.add(:post, "cannot be appealed") if post.is_status_locked? || !post.is_appealable?
end
def self.searchable_includes