Directly delete the "organization is invalid" error

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.
This commit is contained in:
Javi Martín
2023-07-17 01:14:15 +02:00
parent f03ea9d817
commit 08b12a78ff
2 changed files with 2 additions and 2 deletions

View File

@@ -10,7 +10,7 @@ class AccountController < ApplicationController
if @account.update(account_params) if @account.update(account_params)
redirect_to account_path, notice: t("flash.actions.save_changes.notice") redirect_to account_path, notice: t("flash.actions.save_changes.notice")
else else
@account.errors.messages.delete(:organization) @account.errors.delete(:organization)
render :show render :show
end end
end end

View File

@@ -13,7 +13,7 @@ class Organizations::RegistrationsController < Devise::RegistrationsController
if resource.valid? if resource.valid?
super do |user| super do |user|
# Removes unuseful "organization is invalid" error message # Removes unuseful "organization is invalid" error message
user.errors.messages.delete(:organization) user.errors.delete(:organization)
end end
else else
render :new render :new