From 08b12a78ffd55d654af2cddece8721e789f4b956 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Javi=20Mart=C3=ADn?= Date: Mon, 17 Jul 2023 01:14:15 +0200 Subject: [PATCH] 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. --- app/controllers/account_controller.rb | 2 +- app/controllers/organizations/registrations_controller.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/controllers/account_controller.rb b/app/controllers/account_controller.rb index f67f1be0c..88ac41b0f 100644 --- a/app/controllers/account_controller.rb +++ b/app/controllers/account_controller.rb @@ -10,7 +10,7 @@ class AccountController < ApplicationController 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 diff --git a/app/controllers/organizations/registrations_controller.rb b/app/controllers/organizations/registrations_controller.rb index 7b37ee7c2..544432a84 100644 --- a/app/controllers/organizations/registrations_controller.rb +++ b/app/controllers/organizations/registrations_controller.rb @@ -13,7 +13,7 @@ class Organizations::RegistrationsController < Devise::RegistrationsController 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