Files
fizzy/app/models/concerns/notifiable.rb
T
2025-04-22 11:26:56 +02:00

19 lines
345 B
Ruby

module Notifiable
extend ActiveSupport::Concern
included do
has_many :notifications, as: :source, dependent: :destroy
after_create_commit :notify_recipients_later
end
def notify_recipients
Notifier.for(self)&.notify
end
private
def notify_recipients_later
NotifyRecipientsJob.perform_later self
end
end