Sha256: 75fb952b615f7afbd8ba09c2f159d99828cc05b85870d34cc38dc96fd537ad57

Contents?: true

Size: 572 Bytes

Versions: 5

Compression:

Stored size: 572 Bytes

Contents

module Sidekiq
  def self.hook_rails!
    return unless Sidekiq.options[:enable_rails_extensions]
    if defined?(ActiveRecord)
      ActiveRecord::Base.send(:include, Sidekiq::Extensions::ActiveRecord)
    end

    if defined?(ActionMailer)
      ActionMailer::Base.extend(Sidekiq::Extensions::ActionMailer)
    end
  end

  class Rails < ::Rails::Engine
    config.autoload_paths << File.expand_path("#{config.root}/app/workers") if File.exist?("#{config.root}/app/workers")

    initializer 'sidekiq' do
      Sidekiq.hook_rails!
    end
  end if defined?(::Rails)
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
sidekiq-2.3.2 lib/sidekiq/rails.rb
sidekiq-2.3.1 lib/sidekiq/rails.rb
sidekiq-2.3.0 lib/sidekiq/rails.rb
sidekiq-2.2.1 lib/sidekiq/rails.rb
sidekiq-2.2.0 lib/sidekiq/rails.rb