Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed deprecated error handling #3506

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Fixed deprecated ( Enumerating ActiveModel::Errors as a hash has been…
… deprecated)

Calling errors.add to add errors to a record
  • Loading branch information
anitagraham committed Oct 13, 2021

Verified

This commit was signed with the committer’s verified signature.
cuong-tran Cuong-Tran
commit 2b7561c60b5b72c9439c8210fdfe938041b8e1ee
4 changes: 2 additions & 2 deletions core/app/views/refinery/admin/_error_messages.html.erb
Original file line number Diff line number Diff line change
@@ -7,8 +7,8 @@
<li><%= value %></li>
<% end %>
<% else %>
<% object.errors.each do |key, value| %>
<li><%= value %></li>
<% object.errors.each do |error| %>
<li><%= error.message %></li>
<% end %>
<% end %>
</ul>
6 changes: 3 additions & 3 deletions images/lib/refinery/images/validators/image_size_validator.rb
Original file line number Diff line number Diff line change
@@ -7,9 +7,9 @@ def validate(record)
image = record.image

if image.respond_to?(:length) && image.length > Images.max_image_size
record.errors[:image] << ::I18n.t('too_big',
:scope => 'activerecord.errors.models.refinery/image',
:size => Images.max_image_size)
record.errors.add(:image, message: ::I18n.t('too_big',
scope: 'activerecord.errors.models.refinery/image',
size: Images.max_image_size))
end
end