Sha256: f4b218a3db000df214dda8ba10a52efc94282af92a36d8b5c8af21691f4313f7

Contents?: true

Size: 639 Bytes

Versions: 21

Compression:

Stored size: 639 Bytes

Contents

module Sidekiq
  def self.hook_rails!
    return unless Sidekiq.options[:enable_rails_extensions]
    if defined?(ActiveRecord)
      ActiveRecord::Base.extend(Sidekiq::Extensions::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

21 entries across 21 versions & 2 rubygems

Version Path
sidekiq-2.1.1 lib/sidekiq/rails.rb
sidekiq-2.1.0 lib/sidekiq/rails.rb
sidekiq-2.0.3 lib/sidekiq/rails.rb
sidekiq-2.0.2 lib/sidekiq/rails.rb
sidekiq-2.0.1 lib/sidekiq/rails.rb
sidekiq-2.0.0 lib/sidekiq/rails.rb
kulesa-sidekiq-1.2.3 lib/sidekiq/rails.rb
kulesa-sidekiq-1.2.2 lib/sidekiq/rails.rb
sidekiq-1.2.1 lib/sidekiq/rails.rb
sidekiq-1.2.0 lib/sidekiq/rails.rb
sidekiq-1.1.4 lib/sidekiq/rails.rb
sidekiq-1.1.3 lib/sidekiq/rails.rb
sidekiq-1.1.2 lib/sidekiq/rails.rb
sidekiq-1.1.1 lib/sidekiq/rails.rb
sidekiq-1.1.0 lib/sidekiq/rails.rb
sidekiq-1.0.0 lib/sidekiq/rails.rb
sidekiq-0.11.2 lib/sidekiq/rails.rb
sidekiq-0.11.1 lib/sidekiq/rails.rb
sidekiq-0.11.0 lib/sidekiq/rails.rb
sidekiq-0.10.1 lib/sidekiq/rails.rb