DEPRECATION WARNING: alias_method_chain is deprecated

rspec, ruby, ruby-on-rails, ruby-on-rails-5

Solution

Install (unless already installed) ack and run in the terminal:

ack alias_method_chain /Users/username/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.1/gems/

It will indicate all places where `alias_method_chain` is used (files and code lines).

99% chance it is used in some of your gems.

See my answer for a list of things you can do about it.

Problem

I upgraded the project to Rails 5. When I run `rspec` I get a warning ``` DEPRECATION WARNING: alias_method_chain is deprecated. Please, use Module#prepend instead. From module, you can access the original method using super. (called from <top (required)> at /home/alex/projects/myproject/config/application.rb:13) ``` The failing line in application.rb is: ``` Bundler.require(*Rails.groups) ``` How do I find out what is causing this deprecation warning and how to get rid of the error?

Original source

Related problems