Creating Rails-Based Projects
In this section:
In IntelliJ IDEA, one can create several Rails-based project types.
- Rails applications are intended for productive web development with Ruby on Rails.
- Rails API projects are intended for building REST APIs with Rails.
- RailsApp Sample projects are intended for mastering Rails.
Creating Rails-based projects
To create a Rails-based project, follow these general steps
- Do one of the following:
- On the main menu, choose .
- Click Create New Project on the Welcome screen.
- In the New Project dialog box, specify the project name and location. In the left-hand pane, select the desired Rails-based project type.
- Specify the following:
- In the Project SDK drop-down list, select the Ruby SDK you want to use from the list of available Ruby interpreters, installed on your computer. Refer to the section Configuring Ruby SDK for the procedures of installing interpreters.
- If you are working with RVM, you have an additional settings:
When you specify a name for your project, IntelliJ IDEA automatically suggests a gemset with the same name. Click the link Create to have IntelliJ IDEA install a gemset for your new project. Leave the check box selected, so that the gems are put in this gemset when generating your new project.
- In the Rails Version drop-down list, select the desired Rails version from those installed on your machine.
If the desired version is missing, choose Install Rails Gem... command from the drop-down list. IntelliJ IDEA downloads the list of gems. Next, you have to choose one from the drop-down list in the Install rails gem dialog box:
- In the field Rails Template, type the fully qualified path to the desired template file, or click the button , and locate the template file in the file system.
- For the Ruby an Rails application or Rails API project types, specify which database will be used for your new application.
By default, IntelliJ IDEA suggests using SQLite3. If you want to use a different database, select the Preconfigure for the selected database check box, and choose the desired database from the drop-down list.
- For the Ruby an Rails application specify whether IntelliJ IDEA should generate the testing directory structure and template files. To do that, select or clear the check box Skip Test::Unit files. If you leave the check box cleared, IntelliJ IDEA will produce the
testfolder, marked as a test root , with all the necessary infrastructure. If you select this check box, the testing infrastructure will not be generated.
- For the RailsApps Sample, project type select the sample type from the list of available types.
Creating Rails samples
If there are changes to the list of sample projects, click .
- When choosing the project interpreter, keep in mind that Ruby version may be different from the one provided in the file
- If you choose
rvmwith the a gemset, note that this gemset applies to the file
In both cases, IntelliJ IDEA provides the ability to revert: