Commit 979ae68e8634cb053a717925118af3dc4ec64b5d
1 parent
6c1819cc
Exists in
master
and in
21 other branches
Revert "Use load hooks"
This reverts commit e66ab786b3c347022ce2f90c088e8795c3ac0a78.
Showing
1 changed file
with
9 additions
and
8 deletions
Show diff stats
lib/searchkick.rb
... | ... | @@ -12,6 +12,14 @@ require "searchkick/tasks" |
12 | 12 | require "searchkick/middleware" |
13 | 13 | require "searchkick/logging" if defined?(ActiveSupport::Notifications) |
14 | 14 | |
15 | +# background jobs | |
16 | +begin | |
17 | + require "active_job" | |
18 | +rescue LoadError | |
19 | + # do nothing | |
20 | +end | |
21 | +require "searchkick/reindex_v2_job" if defined?(ActiveJob) | |
22 | + | |
15 | 23 | module Searchkick |
16 | 24 | class Error < StandardError; end |
17 | 25 | class MissingIndexError < Error; end |
... | ... | @@ -152,13 +160,6 @@ module Searchkick |
152 | 160 | end |
153 | 161 | end |
154 | 162 | |
155 | -ActiveSupport.on_load(:active_job) do | |
156 | - require "searchkick/reindex_v2_job" | |
157 | -end | |
158 | - | |
159 | 163 | # TODO find better ActiveModel hook |
160 | 164 | ActiveModel::Callbacks.send(:include, Searchkick::Model) |
161 | - | |
162 | -ActiveSupport.on_load(:active_record) do | |
163 | - ActiveRecord::Base.send(:extend, Searchkick::Model) | |
164 | -end | |
165 | +ActiveRecord::Base.send(:extend, Searchkick::Model) if defined?(ActiveRecord) | ... | ... |