Wrap user confirm method with writing role

This commit is contained in:
Fosco Marotto 2021-02-16 16:04:11 -05:00
parent 88d8bd2816
commit 9666472105
1 changed files with 7 additions and 5 deletions

View File

@ -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