IntelliJ IDEA 2017.2 Help

Running Rails Scripts

This feature is supported in the Ultimate edition only.

The following is only valid when Ruby Plugin is installed and enabled!

IntelliJ IDEA enables you to execute Rails scripts using a single menu command. By default, IntelliJ IDEA suggests the scripts that reside in the [<project name>]/script directory of your Rails application.

Results for each script are displayed in its own Run Rails Script tab of the Run tool window, where you can review the script output, change arguments if necessary, and rerun the script.

To run a Rails script

  1. On the main menu, choose Tools | Run Rails Script. Run Rails Script dialog box is displayed.
  2. In the Script field, specify the desired script. If the script resides in the [<project name>]/script directory, type its name only. If the script resides in another directory, type its fully qualified name.
    Alternatively, click the browse button browseButton (Shift+Enter) and select the necessary location in the dialog that opens. Note that this dialog displays only the contents of the [<project name>]/script directory.
    ruby runRailsScript
  3. In the Arguments field, specify the script's arguments, if any. The arguments should be separated with spaces.
    Alternatively, open the Edit Arguments dialog box by clicking the editor button editorIcon, or pressing Shift+Enter, and type the list of arguments.
  4. Click Run.

To rerun a Rails script with new arguments

  1. In the Run tool window, click the desired Run Rails Script tab.
  2. In the toolbar of the Run tool window, click editArguments. Edit Command Line Arguments dialog box is displayed.
  3. In the Edit Command Line Arguments dialog box, type the new arguments separated with spaces, and click OK.
  4. In the toolbar of the Run tool window, click rerun, or press Ctrl+F5.
Last modified: 29 November 2017

See Also