RubyMine 2020.1 Help


RubyMine lets you utilize UML diagrams to analyze Ruby classes, Rails models, gem dependencies, and so on. Depending on the project type and current context (for example, a file/folder selected in a project view or a caret position in the editor), you can use the following diagram types:

Show a class diagram

To display a diagram for a class, do the following:

  1. Select the file containing the required class in the Project view Alt+1 or open the class in the editor.

  2. From the context menu, select Diagrams | Show Diagram Ctrl+Shift+Alt+U or Diagrams | Show Diagram Popup Ctrl+Alt+U.

  3. In the invoked popup, select Ruby Class Diagram and press Enter.

    diagram popup in a project view

    RubyMine will show the class diagram.

    ruby class diagram

You can edit a generated diagram in various ways: add Space or remove Delete classes, display methods and class variables, add notes, and so on.

Show a Rails model diagram

If you work with a Rails project, you can display a dependency diagram for a Rails model. To do this:

  • Press Ctrl+Shift+Alt+U, select Rails Model Dependency Diagram in the invoked popup and press Enter:

    rails model diagram

As for class diagrams, you can edit a model diagram: add Space and remove Delete tables, display association, and migration fields, add notes, and so on.

RubyMine also lets you create new models right from a diagram. To do this, right-click a diagram and select New | ActiveRecord Model. Learn more at Create models.

Work with a diagram

Select elements in a diagram

  • To select an element, click it in the diagram.

  • To select multiple adjacent elements, keep Shift pressed and click the desired elements, or drag a lasso around the elements to be selected.

  • To select multiple non-adjacent elements, keep Ctrl+Shift pressed and click the desired elements.

  • To select a member of a node element, double-click the node element, and then use the arrow keys, or the mouse pointer.

Manage the diagram layout

  • Right-click the diagram background and select the desired layout from the Layout submenu.

  • Drag the diagram elements manually.

  • If necessary, reset the customized layout to the selected from the context menu by clicking the Apply Current Layout button.

Zoom in and out

  • Use the Zoom In and Zoom Out toolbar buttons.

  • Keeping Ctrl key pressed, rotate your mouse wheel up or down.

  • Press NumPad+ or NumPad-.

Use the magnifier tool

  • Keep the Alt key pressed, and hover your mouse pointer over the desired areas of the diagram.

    Magnifier tool

Use the Structure view

  1. Open the Structure view Alt+7 to get a "10,000-feet" look on a diagram.

    preview diagram

    The shadow area represents the visible part of a diagram.

  2. To navigate through the diagram, keep the left mouse button pressed and move the shadow area to obtain the desired view.

Work with source code

Diagrams help you to work with source code in several ways. Right-click the desired node in a diagram and select one of the following actions:

  • Jump to Source F4
    Allows you to jump to a class selected in a diagram.

  • Find Usages Alt+F7
    Finds usages of a class in a project.

  • Refactor
    Allows you to perform various refactoring actions such as renaming a class or extracting a superclass.

Save a diagram

RubyMine enables you to save the diagram to a UML file. This can be useful, for example, if you want to add the diagram's UML file to VSC.

To save the diagram:

  1. Click the save button in the toolbar:

    save diagram button
  2. In the invoked dialog, locate a required directory and click Save.

Configure diagram settings

To configure default settings for diagrams, open the Settings/Preferences dialog and go to the Tools | Diagrams page. Here you can configure the diagram layout, specify various options for different kinds of diagrams, and so on.

Last modified: 29 May 2020