aboutsummaryrefslogtreecommitdiffstats
path: root/app/models/action_mailbox/inbound_email/routable.rb
diff options
context:
space:
mode:
Diffstat (limited to 'app/models/action_mailbox/inbound_email/routable.rb')
-rw-r--r--app/models/action_mailbox/inbound_email/routable.rb11
1 files changed, 11 insertions, 0 deletions
diff --git a/app/models/action_mailbox/inbound_email/routable.rb b/app/models/action_mailbox/inbound_email/routable.rb
new file mode 100644
index 0000000000..1928f9e387
--- /dev/null
+++ b/app/models/action_mailbox/inbound_email/routable.rb
@@ -0,0 +1,11 @@
+module ActionMailbox::InboundEmail::Routable
+ extend ActiveSupport::Concern
+
+ included do
+ after_create_commit :route_later, if: ->(inbound_email) { inbound_email.pending? }
+ end
+
+ def route_later
+ ActionMailbox::RoutingJob.perform_later self
+ end
+end