views:

24

answers:

1

When running my functional tests, I'm getting the following warning in one of the test cases but I can't pinpoint where it's coming from:

gems/actionpack-2.3.8/lib/action_controller/record_identifier.rb:76: warning: Object#id will be deprecated; use Object#object_id

Unfortunately that's the only line of the backtrace that's shown, even if I run it with rake test --trace, and there is no more information in log/test.log.

How can I get the full backtrace for this warning or otherwise figure out which line in my code is causing it?

A: 

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.

Shadwell
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
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

related questions