RubyMine 2018.3 Help

Working with Diagrams

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:

  • Ruby Class Diagram

  • Rails Model Dependency Diagram

  • Gem Dependency Diagram

  • DB Diagrams

  • JavaScript Module Dependency Diagram

Show class diagram

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

  1. In the invoked popup select Ruby Class Diagram and press Enter to display a class diagram in the editor:

    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 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 Creating Models.

Save diagram

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

To save a diagram:

  1. Click the save button in the toolbar:

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

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.

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: 6 December 2018

See Also