venerdì 25 maggio 2012

Finding out where a ruby method is defined

To find out the source file/line of a ruby method definition, do something like the following:

Post.all.method(:all).source_location
Post.first.method(:save).source_location

Here's the source of this tip.