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:
@@ -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
|
||||||
|
|||||||
@@ -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
|
||||||
|
|||||||
Reference in New Issue
Block a user