Fix ActiveModel::Errors#[]= deprecation warning

DEPRECATION WARNING: ActiveModel::Errors#[]= is deprecated and will be
removed in Rails 5.1. Use model.errors.add(:attachment, "content type
image/png does not match any of accepted content types pdf") instead.
(called from validate_attachment_content_type at
/home/travis/build/consul/consul/app/models/document.rb:92)
This commit is contained in:
rgarcia
2018-04-08 14:45:29 +02:00
committed by Julian Herrero
parent f668317cc1
commit b2b418284d
3 changed files with 14 additions and 14 deletions

View File

@@ -51,7 +51,7 @@ class DirectUpload
@relation.valid?
if @relation.errors.key? :attachment
errors[:attachment] = @relation.errors[:attachment]
errors.add(:attachment, @relation.errors.full_messages_for(:attachment))
end
end