How to find the source declaration of any method in Ruby?

How to find the source declaration of any method in Ruby?

Let’s say you want to see where it is declared the method `last` from ActiveRecord, you can do so

Just as simple as:

MyModel.method(:last).source_location

There you go

No Comments

Post A Comment