开发者

Easiest way to "goto source code" for Ruby/Rails

开发者 https://www.devze.com 2023-01-21 02:51 出处:网络
As a Ruby/Rails non-pro, I often want to check out the code for a rails method to see how it\'s implemented...

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

0

精彩评论

暂无评论...
验证码 换一张
取 消