lib/sentry/rails/railtie.rb in sentry-rails-4.6.0 vs lib/sentry/rails/railtie.rb in sentry-rails-4.6.1
- old
+ new
@@ -14,11 +14,14 @@
# because the extension works by registering the around_perform callcack, it should always be ran
# before the application is eager-loaded (before user's jobs register their own callbacks)
# See https://github.com/getsentry/sentry-ruby/issues/1249#issuecomment-853871871 for the detail explanation
initializer "sentry.extend_active_job", before: :eager_load! do |app|
- extend_active_job if defined?(ActiveJob)
+ ActiveSupport.on_load(:active_job) do
+ require "sentry/rails/active_job"
+ prepend Sentry::Rails::ActiveJobExtensions
+ end
end
config.after_initialize do |app|
next unless Sentry.initialized?
@@ -41,14 +44,9 @@
Sentry.configuration.project_root = ::Rails.root.to_s
end
def configure_trusted_proxies
Sentry.configuration.trusted_proxies += Array(::Rails.application.config.action_dispatch.trusted_proxies)
- end
-
- def extend_active_job
- require "sentry/rails/active_job"
- ActiveJob::Base.send(:prepend, Sentry::Rails::ActiveJobExtensions)
end
def extend_controller_methods
require "sentry/rails/controller_methods"
require "sentry/rails/controller_transaction"