Takehiro Adachi

About Talks Ja Posts Email GitHub Twitter

27 Nov 2012
Ffs where is this function defined?

versions: Ruby 1.9.3

When I’m building an app with Rails, I sometimes want to know where exactly is this method defined.

Like when I was using current_page? view helper, I wanted to check the code of it, and check what happens if I added some code to it.

When u write method(:current_page?).source_location, you’ll get where the function is defined like below.

["/Users/Takehiro/.rvm/gems/ruby-1.9.3-p194/gems/actionpack-3.2.8/lib/action_view/helpers/url_helper.rb", 588]

Pretty useful.


Takehiro Adachi at 15:05

About Talks Ja Posts Email GitHub Twitter