Sha256: 8edb7d13fc76f9830e30c856029572180cfa6b399a238724ba29433bb01006b5

Contents?: true

Size: 606 Bytes

Versions: 1

Compression:

Stored size: 606 Bytes

Contents

# Ensure that the `InboundEmail` is automatically scheduled for later incineration if the status has been
# changed to `processed`. The later incineration will be invoked at the time specified by the 
# `ActionMailbox.incinerate_after` time using the `IncinerationJob`.
module ActionMailbox::InboundEmail::Incineratable
  extend ActiveSupport::Concern

  included do
    after_update_commit :incinerate_later, if: -> { status_previously_changed? && processed? }
  end

  def incinerate_later
    ActionMailbox::IncinerationJob.schedule self
  end

  def incinerate
    Incineration.new(self).run
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
actionmailbox-0.1.0 app/models/action_mailbox/inbound_email/incineratable.rb