Duane Johnson
2006-Feb-18 07:07 UTC
[Rails] [ANN] Controller to View and Back Again (TextMate shortcut)
One of the most inconvenient things about the Rails directory structure is the relative distance between the controller and its corresponding view files. While it?s organizationally sound, it?s often a pain to go hunting for a view (especially in a complicated application that has modules and modules within modules). I discovered a fantastic little key-combo within TextMate the other day that almost did what I wanted?if you hit command-option-down, you will be taken from the controller to the corresponding functional test (or from a model to the corresponding unit test). Try it out, it?s really cool. But what I wanted was ease of navigation from my controllers to my views and vice versa. From what I could tell, that?s not a built-in feature of the Rails TextMate command bundles. So I wrote one and bound it to command-option-up. From within a controller''s action, I hit the key combination and it takes me to the view .rhtml file. From within the view file it takes me back to the controller. Swift, easy, precise. See my full post for download, installation and usage instructions. http://blog.inquirylabs.com/2006/02/17/controller-to-view-and-back- again-in-textmate/ Duane Johnson (canadaduane) http://blog.inquirylabs.com/ -------------- next part -------------- An HTML attachment was scrubbed... URL: http://wrath.rubyonrails.org/pipermail/rails/attachments/20060218/52228555/attachment.html
Justin Forder
2006-Feb-18 15:23 UTC
[Rails] [ANN] Controller to View and Back Again (TextMate shortcut)
Duane Johnson wrote:> One of the most inconvenient things about the Rails directory structure > is the relative distance between the controller and its corresponding > view files. While it?s organizationally sound, it?s often a pain to go > hunting for a view (especially in a complicated application that has > modules and modules within modules). > > I discovered a fantastic little key-combo within TextMate the other day > that *almost* did what I wanted?if you hit */command-option-down/*, you > will be taken from the controller to the corresponding functional test > (or from a model to the corresponding unit test). Try it out, it?s > really cool. > > But what I wanted was ease of navigation from my controllers to my views > and vice versa. From what I could tell, that?s not a built-in feature of > the Rails TextMate command bundles. So I wrote one and bound it to > */command-option-up/*. From within a controller''s action, I hit the key > combination and it takes me to the view .rhtml file. From within the > view file it takes me back to the controller. Swift, easy, precise. > > See my full post for download, installation and usage instructions. > > http://blog.inquirylabs.com/2006/02/17/controller-to-view-and-back-again-in-textmate/Great minds... Kyle Shank of RadRails posted the same thought recently: http://www.radrails.org/blog/show/49 Sounds good! (as does flipping between code and tests) Justin
Duane Johnson
2006-Feb-18 17:49 UTC
[Rails] [ANN] Controller to View and Back Again (TextMate shortcut)
On Feb 18, 2006, at 8:23 AM, Justin Forder wrote:> Duane Johnson wrote: > >> One of the most inconvenient things about the Rails directory >> structure is the relative distance between the controller and its >> corresponding view files. While it?s organizationally sound, it?s >> often a pain to go hunting for a view (especially in a complicated >> application that has modules and modules within modules). >> I discovered a fantastic little key-combo within TextMate the >> other day that *almost* did what I wanted?if you hit */command- >> option-down/*, you will be taken from the controller to the >> corresponding functional test (or from a model to the >> corresponding unit test). Try it out, it?s really cool. >> But what I wanted was ease of navigation from my controllers to my >> views and vice versa. From what I could tell, that?s not a built- >> in feature of the Rails TextMate command bundles. So I wrote one >> and bound it to */command-option-up/*. From within a controller''s >> action, I hit the key combination and it takes me to the >> view .rhtml file. From within the view file it takes me back to >> the controller. Swift, easy, precise. >> See my full post for download, installation and usage instructions. >> http://blog.inquirylabs.com/2006/02/17/controller-to-view-and-back- >> again-in-textmate/ > > Great minds... > > Kyle Shank of RadRails posted the same thought recently: > > http://www.radrails.org/blog/show/49 > > Sounds good! (as does flipping between code and tests) > > Justin >Thanks, Justin. I updated the post to point RadRails users in that direction. Looks good! Duane Johnson (canadaduane) http://blog.inquirylabs.com/