From 008eefc0fbd8783124bd72dce6e2dd46e49cca84 Mon Sep 17 00:00:00 2001 From: Tocho Tochev Date: Sun, 22 Sep 2024 22:50:41 +0300 Subject: [PATCH] Fix race condition on emailing for new proposition --- app/models/proposition.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/models/proposition.rb b/app/models/proposition.rb index 2a917c2..7ab07db 100644 --- a/app/models/proposition.rb +++ b/app/models/proposition.rb @@ -4,7 +4,7 @@ class Proposition < ActiveRecord::Base enum status: [:undecided, :approved, :rejected, :backup] delegate :proposable_title, :proposable_type, :proposable_description, to: :proposable - after_create :send_creation_notification + after_commit :send_creation_notification, on: [:create] before_destroy :send_withdrawal_notification def confirm!