Easiest way to “goto source code” for Ruby/Rails – Education Career Blog

As a Ruby/Rails non-pro, I often want to check out the code for a rails method to see how it’s implemented…

For example, I was using “form_for”, and I wanted to check out the code to see how it works. The slightly lame way I did this was to just google “rails form_for” which takes me to http://api.rubyonrails.org/classes/ActionView/Helpers/FormHelper.html, where I can view the source for form_for.

How do rails/ruby pro’s accomplish a similar task? Is there a simple way (without using IDEs) that you can quickly dig this out? Or is it a case of over time learning where stuff is located and find/grep-ing it?

Cheers

,

I clone the rails repository

git clone git://github.com/rails/rails.git

after I grep on it

git grep 'form_for'

After my Vim editor help my with Ctags to navigate on source code.

If you want some example of code using you can see test unit.

,

I prefer http://railsapi.com/ both local and remote. Quick search, nice design and magic Show on Github link

Leave a Comment