mirror of
https://github.com/mperham/sidekiq.git
synced 2022-11-09 13:52:34 -05:00
e12bf878fa
Replaced with `__send__` from std lib * `send` can now be overridden to be more semantically meaningful * `message.send(user_id)` as opposed to `message.send_message(user_id)` * `__send__` makes it clear that the reflective version is intended
19 lines
524 B
Ruby
19 lines
524 B
Ruby
module Sidekiq
|
|
def self.hook_rails!
|
|
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
|