Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion app/models/contact.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,9 @@ class Contact < ApplicationRecord

has_rich_text(:message)

after_create(:send_message)
# Enqueue email only after commit to avoid timing issues where the job runs
# before the contact creation is visible outside the transaction.
after_create_commit(:send_message)

def default_message
<<~MSG
Expand Down
4 changes: 3 additions & 1 deletion app/models/notification.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@ class Notification < ApplicationRecord
belongs_to :notifiable, polymorphic: true
belongs_to :linkeable, polymorphic: true, optional: true

after_create(:send_email_notification)
# Enqueue email only after commit to avoid timing issues where the job runs
# before the notification creation is visible outside the transaction.
after_create_commit(:send_email_notification)
after_save(:broadcast_notification_count)
after_create(:broadcast_web_notification)

Expand Down
Loading