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

It can be helpful when debugging to know what "super" is actually calling.

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 = A.new
a.foo # => bar

b = B.new
b.foo # => #<Method: A#foo>

Let's Connect

Keep Reading

Use Slack For Rails Error Notification

Post a message to one of your Slack channels when your Rails app encounters a 500 error.

Dec 22, 2015

Dynamic Routing in Middleman

Take Middleman's dynamic pages feature, combine it with data modeling, and voila! We have dynamic routing in Middleman.

May 04, 2018

Add a Console to your Ruby Project

A powerful way to debug Rails applications is in using the Rails console. But even when you're not using Rails for your Ruby project, you can still have a console.

Aug 06, 2018