RubyMine 2017.1 Help

Creating Rails Application Elements

In this section:

Introduction

RubyMine helps populate your Rails applications with the stubs of all the required elements, and provides the following ways of launching the generators:

  • The standard Alt+Insert functionality.
  • Tools | Run Rails Generator command on the main menu.
  • File | New command on the main menu
Thus RubyMine launches the generate script with the element name specified as a parameter, and a list of arguments. As a result, RubyMine produces the required application elements and places them to the proper locations of the directory structure.

Creating Rails application elements

To create a stub of a Rails application element

  1. Do one of the following:
    • On the main menu, choose Tools | Run Rails Generator.
    • Press Ctrl+Shift+A, start typing Run Rails generators and press Enter:
      /help/img/idea/2017.1/rm_run_rails_generators.png
    • On the main menu, choose File | New - Run Rails Generators.
    • Press Ctrl+Alt+G.
    • With the editor, or the Project tool windows having the focus, press Alt+Insert, or choose New on the context menu of the Project tool window. Then choose Run Rails Generator.
  2. In the pop-up frame that opens, start typing the desired generator name, or its part. As you type, the suggestion list shrinks to show the matching entries only:
    /help/img/idea/2017.1/rm_railsGenerateMigration1.png
  3. In the dialog box that opens, specify the name of the new application element, and a list of arguments.

    Besides that, choose the desired environment:

    /help/img/idea/2017.1/rm_choose_env.png
  4. If necessary, select the check boxes that correspond to the general options of the generate script.
  5. Click OK. RubyMine runs the generate script and displays output messages in the dedicated tab of the Run tool window:
    /help/img/idea/2017.1/rm_railsGenerateMigration2.png

    Note that the action of creating Rails application elements can be rolled back. So doing, all the created files will be deleted:

    /help/img/idea/2017.1/rm_rails_gerenate_rollback.png

See Also

Last modified: 18 July 2017