RDT and RadRails Keyboard Shortcuts

posted in: rails, ruby | 0

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 😉