6. カーソルのある部分を判定して、よきにジャンプ
◦ とにかく「行きたいな」と思ったところにカーソルを置いて と入力し
てみる
◦ 以下、ドキュメントの一部抜粋
Example uses of |gf|, and where they might lead.
(* indicates cursor position)
>
Pos*t.first
< app/models/post.rb ~
>
has_many :c*omments
< app/models/comment.rb ~
>
link_to 'Home', :controller => 'bl*og'
< app/controllers/blog_controller.rb ~
6
7. User モデルに行きたい場合
:Rmodel user
◦ tab で補完できます
:Rmo[tab] us[tab]
UsersController に行きたい場合
:Rcontroller user
◦ Userモデルを開いている状態なら省略可能です
:Rcontroller
他は想像通りです。view, helper, layout, ...
◦ 行きたいところをイメージして、頭文字入力⇒Tabと続く...
7
8. ]f を使っての コントローラとビューの行ったり来たりが
便利!
Current file Alternate file Related file
model unit test schema definition
controller (in method) functional test template (view)
template (view) functional test controller (jump to method)
migration previous migration next migration
config/database.yml config/routes.rb config/envrionments/*.rb
◦ [f と ]f は Alternate と Related です
◦ この辺は体で覚える感じです
8