Cobwwweb logo

Find the Source of a Ruby Method's "Super"

Oct 12, 2016 Ruby

I've spent part of the last couple days debugging the bowels of a pesky Rails project. The issue was the infamous Stack Level Too Deep error.

I found the source of the problem was a gem's method calling super. And while the stack trace of an error will show you the pathway of an error, sometimes it can be helpful to manually find that pathway yourself during the debugging process.

It can be done in a quick one-liner using the name of the method:


Where method_name is the name of the method you want to check.

Here's a simplistic example to demonstrate:

class A
  def foo

class B < A
  def foo

a = # => bar

b = # => #<Method: A#foo>

Did you learn something or find this article interesting?

If so, why not

Want to receive exactly one email every month with new articles, tools, and references I've discovered? Sign up below. (More info here.)