RDT and RadRails Keyboard Shortcuts
RDT together with RadRails on Eclipse is a pretty convenient development environment when doing things in Ruby on Rails. A little unknown are the keyboard shortcuts, which make your day even more productive. Here’s a list of those:
Ctrl-Alt-T
Jump to the test case of a model or controller and vice versa.
Ctrl-Shift-V
Jump to the view of a controller method and vice versa.
Ctrl-Alt-X
Factor out a partial from a view. Simply select the code block you want to factor out into a separate partial an press the key combination. A window opens an you can enter the name for the new partial (dont’t forget the _ and the .rhtml).
Ctrl-Shift-F
Auto-format the selected code (Ruby only). Not that mature, yet, and seems to have problems with regular expression - currently not recommended to use.
Ctrl-Shift-C
Toggle comment (Ruby only), i.e. the selected code block will be commented out if it wasn’t (# are inserted in the first column of each row), and vice versa.
Especially jumping between models/controllers and their test-cases/views saves you a lot of hassle like “where’s that file again in my damn folder hierarchy”, especially when your project gets larger.
Oh and one more thing: The listed shortcuts are the ones coming with RDT/RadRails additionally to the ones already included in Eclipse. You can always check those out via Window->Preferences->General->Keys. Gems are awaiting you
Hi, the name's Steffen and I'm writing about the Web, programming
and all those things coming to my mind. Enjoy your stay.
February 13th, 2007 at 23:02
Hi,
the rails plugin for gvim has easy shortcuts as well.
Had problems some time ago with the RDT/Radrails debugger (e.g. local variable view). Does it work now?
In general: I like the rails “magic”, but as a beginner I think it’s sometimes a bit intransparent (or needs a lot of further study). E.g. that belongs_to is an instance method in the API-doc, but nevertheless mixed in in the end as a class method of ActiveRecord::Base. How should You know that easily. E.g. that instance variables of the controller are available to the corresponding views. etc. Do You know about any docu explaining some of the magic? With Ruby itself I don’t have the feeling, that I do things, that hopefully work but where I don’t really understand why. Maybe it will change with more practice.
February 14th, 2007 at 0:09
gvim - nice one
- never tried the RDT debugger, btw…
As for the magic, my trick is to learn, learn, learn… No, seriously, the problems you mention are problems. In fact, if you wanna do some “non-standard-stuff” with Rails, all you can do is check out it’s source code. And sometimes the spot you’re looking for is pretty well hidden.
There is, however, light at the end of the tunnel. Tools will emerge to make things more transparent. Here’s one example: http://morki.ch/res/rubyrefactoring.pdf - I’m looking forward to this one.
Keep on going, dude
Leave a Reply