I am using Ruby on Rails with the pry gem. When an error occurs during a rake task, I get a very nice stack trace.
When however I do something in my rails console that triggers an exception, I only get to see the error message and the one line of code that triggered it (which most of the time is somewhere in the rails core).
Is there a way to enable these stack dumps in the console?
I found a solution myself.
Apparently, I was in need of the command wtf?
that comes with pry.
[7] project » p.known_attributes
NoMethodError: undefined method `foo' for #<Bar:0x007f871fd12a38>
from /[...]/gems/activemodel-4.0.0/lib/active_model/attribute_methods.rb:436:in `method_missing'
[8] project » wtf?
Exception: NoMethodError: undefined method `foo' for #<Bar:0x007f871fd12a38>
--
[... stack dump ...]
[9] project »