1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00
rails--rails/activejob/lib/active_job/railtie.rb

34 lines
900 B
Ruby
Raw Normal View History

2017-07-09 13:49:52 -04:00
# frozen_string_literal: true
require "global_id/railtie"
require "active_job"
2014-05-21 16:45:56 -04:00
module ActiveJob
# = Active Job Railtie
class Railtie < Rails::Railtie # :nodoc:
config.active_job = ActiveSupport::OrderedOptions.new
initializer "active_job.logger" do
2014-05-21 17:10:17 -04:00
ActiveSupport.on_load(:active_job) { self.logger = ::Rails.logger }
2014-05-21 16:45:56 -04:00
end
initializer "active_job.set_configs" do |app|
options = app.config.active_job
options.queue_adapter ||= :async
ActiveSupport.on_load(:active_job) do
options.each { |k, v| send("#{k}=", v) }
end
end
initializer "active_job.set_reloader_hook" do |app|
ActiveSupport.on_load(:active_job) do
ActiveJob::Callbacks.singleton_class.set_callback(:execute, :around, prepend: true) do |_, inner|
app.reloader.wrap do
inner.call
end
end
end
end
2014-05-21 16:45:56 -04:00
end
end