Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how do I go about tracking down DEPRECATION WARNING related to Bundler

I'm pretty new to Rails. I keep seeing these deprecation warnings when I start my app:

DEPRECATION WARNING: ref is deprecated and will be removed from Rails 3.2. 
(called from <top (required)> at D:/dev/AquaticKodiak/config/application.rb:12)
DEPRECATION WARNING: new is deprecated and will be removed from Rails 3.2. 
(called from <top (required)> at D:/dev/AquaticKodiak/config/application.rb:12)

OK, what's on line 12? This:

Bundler.require(:default, :assets, Rails.env)

Hmm, that's not really narrowing it down. This says to me that one of the gems that's related to my app is using a keyword that will disappear soon. I'd really like to figure out which one. All the gems in my gemfile are using the >= [version] syntax, except the ones that are coming from github. I suspect that the github stuff is causing this, but how do I find out which project it is? Pulling code and searching for the keyword looks like work -- is there an easier way?

like image 832
jcollum Avatar asked Nov 14 '11 17:11

jcollum


People also ask

How do I track deprecation warnings?

Once you have all the deprecation warnings (or most of them) from your application, it is a good idea to track them as if they were issues. You can use the project management tool of your preference (we use Pivotal Tracker) and create a story in the backlog for each root cause of the deprecation warnings.

How do I find deprecation warnings in rails?

In Rails, all deprecation warnings start with DEPRECATION WARNING:, so you can search for that string in your logs. When it comes to production, the easiest way to discover deprecation warnings is by using a monitoring tool (like Honeybadger or Airbrake ).

What happens if a disallowed deprecation is introduced?

If a disallowed deprecation is introduced, it will be treated as a failure and raise an exception in development and test. In production it will log the deprecation as an error. Check out this PR for more details about this new feature. Depending on the size of your application, addressing all deprecation warnings can take quite some time.


1 Answers

The Rails deprecation warning is pretty unhelpful here. It has a complete callstack that could help you find the out of date gem, but is filtering the result to return the first non-framework point in the callstack, in this case application.rb.

To find the offending gem I would grab the full callstack at ActiveSupport::Deprecation.warn, which is defined at line 10 of activesupport/lib/active_support/deprecation/reporting.rb.

If you have Pry installed (recommended) then add a conditional binding at line 11 of reporting.rb:

binding.pry if message =~ /ref is deprecated/

Then inspect caller.

If you post a Gemfile I can take a look for you.

like image 174
chuckdbacon Avatar answered Dec 05 '22 14:12

chuckdbacon