Dealing with deprecations warnings can be quite hard. Especially when it comes to tracing all occurrences. Normally you got one line of Deprecation warning and of course, it’s not enough.
DEPRECATION WARNING:Module#parent has been renamed to module_parent.parent is deprecated and will be removed in Rails 6.1. (called from render_list at /drone/src/app/controllers/example_controller.rb:89)
To track down the deprecation we can use debug config.
ActiveSupport::Deprecation.debug = true
It should be used in app/application.rb
after rails have been loaded and before Bundler loads other gems.
require "rails/all"
-> ActiveSupport::Deprecation.debug = true
# Require the gems listed in Gemfile, including any gems
# you've limited to :test, :development, or :production.
Bundler.require(*Rails.groups)
It will expand stack trace to the last call, so we will get output like:
DEPRECATION WARNING: `Module#parent` has been renamed to `module_parent`. `parent` is deprecated and will be removed in Rails 6.1. (called from render_list at /Users/.../app/controllers/example_controller.rb:89)
/Users/.../.rvm/gems/ruby-2.6.6/gems/active_model_serializers-0.9.5/lib/action_controller/serialization.rb:63:in `namespace_for_serializer'
/Users/.../.rvm/gems/ruby-2.6.6/gems/active_model_serializers-0.9.5/lib/action_controller/serialization.rb:68:in `block in default_serializer'
/Users/.../.rvm/gems/ruby-2.6.6/gems/active_model_serializers-0.9.5/lib/action_controller/serialization.rb:67:in `tap'
(...)
/Users/.../.rvm/gems/ruby-2.6.6/gems/wicked_pdf-2.1.0/lib/wicked_pdf/pdf_helper.rb:46:in `call'
/Users/.../.rvm/gems/ruby-2.6.6/gems/wicked_pdf-2.1.0/lib/wicked_pdf/pdf_helper.rb:46:in `render_with_wicked_pdf'
/Users/.../.rvm/gems/ruby-2.6.6/gems/wicked_pdf-2.1.0/lib/wicked_pdf/pdf_helper.rb:30:in `render'
As seen in the example, it looks like active_model_serializers
gem was using a deprecated method. Solution? Update gem. 😉