Run Rails applications
RubyMine allows you to run or debug Rails applications by using the configured set of startup parameters - run/debug configurations. For instance, you can specify the following parameters for the Rails run/debug configuration: a server type (such as Puma or Passenger), IP address and port, environment (development by default), and so on. Note that for Rails projects, RubyMine automatically creates the development and production run/debug configurations with the corresponding Rails environments.
In this topic we'll show you how to:
Run the Rails server for the first time without a run configuration
Run the Rails server with a run configuration
Configure additional parameters for running the Rails server
Run the Rails server without configuring
To run the Rails server for the first time without any configuring, do the following:
Press Ctrl twice.
rails servercommand in the invoked popup and pressEnter.
Wait until RubyMine starts the Rails server. The Run tool window shows the application's output.
After you've run the Rails server, RubyMine automatically creates a special profile - a temporary run/debug configuration. You can customize settings of this configuration, for example, a server type, IP address and port, environment, and so on. Then, you can save the customized configuration to quickly run this configuration in the future.
Run the Rails server using a run/debug configuration
You can run the Rails server with the existing run/debug configurations in one of the following ways:
Press Ctrl twice to invoke the Run Anything popup. Start typing the required configuration name, select it from the list, and press Enter.
Click the button on the toolbar to run the currently selected run/debug configuration.
Select theShift+F10 command from the main menu and select the required configuration.
Configure Rails server parameters
When you run the Rails server for the first time, RubyMine automatically creates a corresponding Rails temporary configuration, which can be saved. If necessary, you can create the Rails run/debug configuration manually from the predefined template.
To customize the run/debug configuration, do the following:
Open the Run/Debug Configuration dialog in one of the following ways:
Selectfrom the main menu.
With the Navigation bar visible ( ), choose from the run/debug configuration selector.
Press Shift+Alt+F10, then press 0 or select the configuration from the popup and press F4.
In the opened Run/Debug Configurations dialog, select the required configuration in the Rails group, and specify its settings.
For example, you can specify the following settings in the Configuration tab:
Server IP Address
Specify the IP address where the Rails server will be accessible.
Specify the port used to run the Rails server.
Type optional server arguments. You can run the
rails server --helpcommand in the terminal emulator to learn more about available arguments.
Select the required Rails environment to run the server.
This option is only enabled for the Rails mountable engine projects. Specify here the absolute path to the dummy directory. This path is required to run the engine.
Use this option to enable opening an application automatically in a default browser.
Specify the list of environment variables as the name-value pairs, separated with semi-colons. Alternatively, click the ellipsis button to create variables and specify their values in the Environment Variables dialog.
Specify the command-line arguments to be passed to the Ruby interpreter.
Specify the Ruby interpreter used to run the server. You can choose the project default Ruby SDK, or select a different one from the list of configured Ruby SDKs.
Rerun an application
To rerun the launched application, do the following:
In the Run tool window, select the tab where the desired application is opened.
In the toolbar of the Run tool window, click the buttonCtrl+F5.