Skip to content

Instantly share code, notes, and snippets.

@fakefarm
Created May 31, 2016 18:55
Show Gist options
  • Save fakefarm/a8818a6adabbddf2a8e505bd04d6644e to your computer and use it in GitHub Desktop.
Save fakefarm/a8818a6adabbddf2a8e505bd04d6644e to your computer and use it in GitHub Desktop.
I’m calling `super` but I don’t know where that goes

I’m calling super but I don’t know where that goes

By @tenderlove. Full post I am puts debugger

Here I can see that render calls super, but I don’t know where that is implemented. In that case, I use super_method on the return value of method.

So I change this:

def index
  p method(:render).source_location
  render params[:id]
end

To this:

def index
  p method(:render).super_method.source_location
  render params[:id]
end

Run the same request through, and I get this for the output:

Processing by UsersController#show as */*
  Parameters: {"id"=>"xxxx"}
["/Users/aaron/git/rails/actionpack/lib/action_controller/metal/rendering.rb", 34]
Completed 500 Internal Server Error in 34ms (ActiveRecord: 0.0ms)

Now I see that super goes here. That method also calls super, but I can just rinse and repeat the above process (or use a loop!) to find the method I actually care about.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment