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.
Run the Rails server without configuring
To run the Rails server for the first time without any configuring, do the following:
Press Ctrl twice.
Type the
rails server
command in the invoked popup and press Enter.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.
Select the desired configuration on the toolbar and click Shift+F10.
Select
Alt+Shift+F10 from the main menu, select the desired configuration from the list and press Enter.
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:
Select
from the main menu.With the Navigation bar visible ( ), choose from the run/debug configuration selector.
Press Alt+Shift+F10 and then press 0.
In the opened Run/Debug Configurations dialog, select the required configuration in the Rails group, and specify its settings.
Run/debug configuration: Rails
Configuration tab
Item | Description |
---|---|
Server | Specify a web server for running a Rails application. You might need to install a corresponding gem to the project SDK (for example, Available servers: Trinidad and Torquebox notes Both Trinidad and TorqueBox servers require the following prerequisites to be met:
Unicorn notes Note that Unicorn kills worker processes that take too long to respond. To avoid error messages, add the following lines to the unicorn configuration file unicorn.rb:
if ENV['IDE_PROCESS_DISPATCHER']
timeout 30 * 60 * 60 * 24
end
|
IP Address | Specify the IP address where the Rails server will be accessible. |
Port | Specify the port to run the Rails server. |
Server arguments | Type optional server arguments. You can run the |
Environment | Select the required Rails environment to run the server ( |
Dummy app | This field is only enabled for the Rails mountable engine projects. Specify the absolute path to the dummy directory. This path is required to run the engine. |
Environment variables | Specify the list of environment variables as the name-value pairs, separated with semi-colons. Alternatively, click to create variables and specify their values in the Environment Variables dialog. |
Ruby arguments | Specify the command-line arguments to be passed to the Ruby interpreter. When such a run/debug configuration is launched, RubyMine analyzes the running processes, and does one of the following, depending on the presence of the running Nailgun server:
Classpath property is added to Nailgun settings. |
Ruby SDK | Specify the desired Ruby interpreter. You can choose the project default Ruby SDK, or select a different one from the list of configured Ruby SDKs. |
Run browser | Select this option to enable opening an application automatically in a default browser. |
Start JavaScript debugger automatically | Enable this option to start the JavaScript debugger. |
Ruby arguments | Specify the command-line arguments to be passed to the Ruby interpreter. |
Ruby SDK | Specify the desired Ruby interpreter. You can choose the project default Ruby SDK, or select a different one from the list of configured Ruby SDKs. |