Trace source of deprecation warnings in rails tests?

Had the same issue. A gem was causing a deprecation warning but I had no idea which gem since Rail's message only shows the last bit of the callstack in my code. Add the following: module ActiveSupport::Deprecation class After require 'rails/all in application.

Rb) but before bunder runs to catch deprecation warning in gems (i.e. Before Bundler. Require(:default, Rails.

Env) if defined?(Bundler) in application. Rb) Now when a deprecation warning is encountered you are dropped in the debugger. You can either leave this in (and surround with a if Rails.env.

Test? ) or remove it when you have found your issues.

Had the same issue. A gem was causing a deprecation warning but I had no idea which gem since Rail's message only shows the last bit of the callstack in my code. Add the following: module ActiveSupport::Deprecation class After require 'rails/all' in application.

Rb) but before bunder runs to catch deprecation warning in gems (i.e. Before Bundler. Require(:default, Rails.

Env) if defined?(Bundler) in application. Rb). Now when a deprecation warning is encountered you are dropped in the debugger.

You can either leave this in (and surround with a if Rails.env. Test? ) or remove it when you have found your issues.

When I get this kind of warning in my tests it is usually because I am using mocking model objects and am not providing all the methods that active record provides for real. A good starting point would be the rails code itself. Looking at the source code for the action_pack gem which is referenced, the method that is causing the error is dom_id.

That method generates an id for an object for use on a page. It seems to be called in a couple of places internally (unless you are calling it directly of course! ) but the most likely cause appears to be calling form_for on an object.

I was hoping for a more general answer, not specifically for this error, but it makes sense: stepping in through the rails source was exactly what I ended up doing; it's probably the only way to do it. I added a breakpoint unless record. Kind_of?(ActiveRecord::Base) above that line in actionpack so I could call where and get the full stack.(Turns out it was a content_tag_for...) – Andrew Vit Sep 8 '10 at 22:39 Right, I see.

I couldn't figure out a way of getting any more information other than stepping into the rails code and working back. You don't have to accept my answer if it doesn't answer what you wanted! – Shadwell Sep 8 '10 at 22:47.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions