Skip to content

Commit

Permalink
Directly delete the "organization is invalid" error
Browse files Browse the repository at this point in the history
We were getting a warning since upgrading to Rails 6.1:

DEPRECATION WARNING: Calling `delete` to an ActiveModel::Errors messages
hash is deprecated. Please call `ActiveModel::Errors#delete` instead.

So we're deleting the error instead of deleting the message.
  • Loading branch information
javierm committed Sep 7, 2023
1 parent 922b214 commit 1c32b07
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion app/controllers/account_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ def update
if @account.update(account_params)
redirect_to account_path, notice: t("flash.actions.save_changes.notice")
else
@account.errors.messages.delete(:organization)
@account.errors.delete(:organization)
render :show
end
end
Expand Down
2 changes: 1 addition & 1 deletion app/controllers/organizations/registrations_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ def create
if resource.valid?
super do |user|
# Removes unuseful "organization is invalid" error message
user.errors.messages.delete(:organization)
user.errors.delete(:organization)
end
else
render :new
Expand Down

0 comments on commit 1c32b07

Please sign in to comment.