RubyMine includes several commands to simplify working with Rails views. In this post, we’ll look at OS X keyboard shortcuts for view navigation, creation, and previewing; ERB code generation and refactoring; and HTML code generation and navigation.
Navigate from an action to its corresponding view with
command + control + Up.
If an action doesn’t have a view, RubyMine will offer to create one.
command + control + Up again to navigate from a view back to its action.
Preview a view in a browser with
option + F2.
Generate ERB expressions with
command + shift + .
command + option + T to surround a selection with markup or ERB.
Refactor a selection into a partial with
control + T.
Generate opening and closing HTML tags by entering a tag name followed by
i m g Tab.
Use powerful Emmet abbreviations to easily generate markup.
Change/rename a tag with
shift + F6.
View a CSS selector’s declaration inline with
option + Space.
Navigate to it with
command + B.
Accurately search for its usage with usage search, e.g.,
option + F7 to “Find Usages”.
A Familiar Feeling
The Rails view equivalents of commonly used commands such as “Go to declaration”, “Rename”, and “Find Usages”, thankfully, have been designed to work with HTML tags and CSS selectors. Powerful code generation helps simplify tedious view ceremony. Add in a few more view-specific commands, and Rails view development feels just as productive as everything else in RubyMine.
About the AuthorMore Content by Jared Carroll