Sha256: ca088e2e6a3f40324cf1c53f4867502e0af75e4672a56104770454635248c126
Contents?: true
Size: 802 Bytes
Versions: 14
Compression:
Stored size: 802 Bytes
Contents
require 'apartment/delayed_job/enqueue' module Apartment module Delayed module Job # Before and after hooks for performing Delayed Jobs within a particular apartment database # Include these in your delayed jobs models and make sure provide a @database attr that will be serialized by DJ # Note also that any models that are being serialized need the Apartment::Delayed::Requirements module mixed in to it module Hooks attr_accessor :database def before(job) @_current_database = Apartment::Database.current_database Apartment::Database.switch(job.payload_object.database) if job.payload_object.database end def after Apartment::Database.switch(@_current_database) end end end end end
Version data entries
14 entries across 14 versions & 1 rubygems