From 96664721050a1951ced0fefab8270b0ee2b9b00b Mon Sep 17 00:00:00 2001 From: Fosco Marotto Date: Tue, 16 Feb 2021 16:04:11 -0500 Subject: [PATCH] Wrap user confirm method with writing role --- app/models/user.rb | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/app/models/user.rb b/app/models/user.rb index 28c3302d..f2699776 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -123,13 +123,15 @@ class User < ApplicationRecord end def confirm - new_user = !confirmed? - self.approved = true if open_registrations? + ActiveRecord::Base.connected_to(role: :writing) do + new_user = !confirmed? + self.approved = true if open_registrations? - super + super - if new_user && approved? - # prepare_new_user! + if new_user && approved? + # prepare_new_user! + end end end