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