# Get started with an imported Rails project

> **TL;DR**
> Required plugin: [Ruby](ruby-plugin.html)

IntelliJ IDEA is an integrated development environment (IDE) that helps you be more productive in every aspect of Ruby/Rails projects development – from writing and debugging code to testing and deploying a completed application. IntelliJ IDEA is available for different platforms including macOS, Windows, and Linux.

In this tutorial, we’ll show you the main IntelliJ IDEA capabilities using a [fork](https://github.com/JetBrains/sample_rails_app) of a sample application created for the [Ruby on Rails Tutorial](https://www.railstutorial.org). Before starting this tutorial, do the following:

* Install [Git](https://git-scm.com/book/en/v2/Getting-Started-Installing-Git).

* Install the [Ruby distribution](https://www.jetbrains.com.cn/en-us/help/ruby/set-up-a-ruby-development-environment.html#ruby) for your platform.

* Install [Node.js](https://nodejs.org/en/download/) and [Yarn](https://yarnpkg.com/en/docs/install).

We'll perform all steps using IntelliJ IDEA installed on macOS.

## Clone a project

First of all, we need to clone the repository containing the sample application:

Procedure:

1. Run IntelliJ IDEA and click Clone Repository on the [Welcome Screen](null).

![Welcome Screen / Clone Repository](https://resources.jetbrains.com.cn/help/img/idea/2026.2/ij_welcome_screen_get_from_vcs.png)

2. In the Clone Repository dialog, do the following:

![Clone Repository dialog](https://resources.jetbrains.com.cn/help/img/idea/2026.2/rm_get_started_get_from_version_control_dialog.png)

* Make sure that Git is selected in the Version control field.

* Insert the following address in the URL field: `https://github.com/JetBrains/sample_rails_app_8th_ed.git`

Click the Clone button. IntelliJ IDEA will show a progress bar indicating a cloning process.

3. After cloning the repository, IntelliJ IDEA opens the project and starts the project analysis process. You can see the progress in the [Status Bar](null).

![Project analysis](https://resources.jetbrains.com.cn/help/img/idea/2026.2/rm_get_started_project_analysis_progress.png)

IntelliJ IDEA analyzes your project to examine its sources and collects the information on available files, class and method definitions, and so on. This is required for code insight features such as code completion and navigation.

> **Tip:**
> Project analysis is triggered when you open a project for the first time, install dependencies, add new files to a project, get updates from a version control system, or switch branches.

## Select a Ruby interpreter and install gems

After you opened the project, it is necessary to make sure the required Ruby interpreter is configured and install the dependencies specified in the project's `Gemfile`.

The IDE detects all installed Ruby interpreters and selects the appropriate option based on the project. If there's a conflict between the automatically selected Ruby interpreter and the project settings or no interpreter was detected, you can [configure it
manually](configuring-language-interpreter.html).

Procedure: Install the gems

1. Install the gems specified in the `Gemfile`. IntelliJ IDEA allows you to use [Bundler](https://bundler.io) to manage gems. Press `Ctrl` (Windows), `Ctrl` (macOS), `Ctrl` (IntelliJ IDEA Classic (macOS)), `Ctrl` (macOS System Shortcuts), `Ctrl` (XWin), `Ctrl` (GNOME), `Ctrl` (KDE), `Ctrl` (Emacs), `Ctrl` (Sublime Text), `Ctrl` (Sublime Text (macOS)), `Ctrl` (NetBeans), `Ctrl` (Visual Studio), `Ctrl` (Visual Studio (macOS)), `Ctrl` (Eclipse), `Ctrl` (Eclipse (macOS)) twice and start typing bundle install. Then, select the `bundle install` command from the list and press `Enter` (Windows), `⏎` (macOS), `⏎` (IntelliJ IDEA Classic (macOS)), `⏎` (macOS System Shortcuts), `Enter` (XWin), `Enter` (GNOME), `Enter` (KDE), `Enter` (Emacs), `Enter` (Sublime Text), `⏎` (Sublime Text (macOS)), `Enter` (NetBeans), `Enter` (Visual Studio), `⏎` (Visual Studio (macOS)), `Enter` (Eclipse), `⏎` (Eclipse (macOS)).

![Run Anything / bundle install](https://resources.jetbrains.com.cn/help/img/idea/2026.2/ij_ruby_run_any_bundle_install.png)

2. Wait until IntelliJ IDEA installs all gems.

![Run Tool window / installing gems](https://resources.jetbrains.com.cn/help/img/idea/2026.2/ij_ruby_gems_installation_output.png)

## Run migrations

Before running our Rails application, we need to migrate the database.

Procedure:

1. Press `Ctrl` (Windows), `Ctrl` (macOS), `Ctrl` (IntelliJ IDEA Classic (macOS)), `Ctrl` (macOS System Shortcuts), `Ctrl` (XWin), `Ctrl` (GNOME), `Ctrl` (KDE), `Ctrl` (Emacs), `Ctrl` (Sublime Text), `Ctrl` (Sublime Text (macOS)), `Ctrl` (NetBeans), `Ctrl` (Visual Studio), `Ctrl` (Visual Studio (macOS)), `Ctrl` (Eclipse), `Ctrl` (Eclipse (macOS)) twice and type `db:migrate`. Select rake db:migrate in the dropdown and press `Enter` (Windows), `⏎` (macOS), `⏎` (IntelliJ IDEA Classic (macOS)), `⏎` (macOS System Shortcuts), `Enter` (XWin), `Enter` (GNOME), `Enter` (KDE), `Enter` (Emacs), `Enter` (Sublime Text), `⏎` (Sublime Text (macOS)), `Enter` (NetBeans), `Enter` (Visual Studio), `⏎` (Visual Studio (macOS)), `Enter` (Eclipse), `⏎` (Eclipse (macOS)). Press `Ctrl` (Windows), `Ctrl` (macOS), `Ctrl` (IntelliJ IDEA Classic (macOS)), `Ctrl` (macOS System Shortcuts), `Ctrl` (XWin), `Ctrl` (GNOME), `Ctrl` (KDE), `Ctrl` (Emacs), `Ctrl` (Sublime Text), `Ctrl` (Sublime Text (macOS)), `Ctrl` (NetBeans), `Ctrl` (Visual Studio), `Ctrl` (Visual Studio (macOS)), `Ctrl` (Eclipse), `Ctrl` (Eclipse (macOS)) twice, type `db :migrate`, and press `Enter` (Windows), `⏎` (macOS), `⏎` (IntelliJ IDEA Classic (macOS)), `⏎` (macOS System Shortcuts), `Enter` (XWin), `Enter` (GNOME), `Enter` (KDE), `Enter` (Emacs), `Enter` (Sublime Text), `⏎` (Sublime Text (macOS)), `Enter` (NetBeans), `Enter` (Visual Studio), `⏎` (Visual Studio (macOS)), `Enter` (Eclipse), `⏎` (Eclipse (macOS)).

![Run Anything / rake db:migrate](https://resources.jetbrains.com.cn/help/img/idea/2026.2/ij_ruby_run_any_db_migrate.png)

2. Leave the default settings in the invoked Execute ‘db:migrate’ dialog and click OK.

![Execute db:migrate](https://resources.jetbrains.com.cn/help/img/idea/2026.2/ij_ruby_execute_db_migrate_dialog.png)

This creates the `development.sqlite3` database in the `db` folder.

3. Run `rake db:migrate` one more time as described in the first step. This time, set the Environment option to test in the Execute ‘db:migrate’ dialog and click OK. The created `test.sqlite3` database will be used to run tests.

## Navigate through the project

IntelliJ IDEA provides rich navigation capabilities to explore projects of any sizes. You can navigate between files, go to declarations, search entities of any types, and so on.

### Project view

The Project view (`Alt+1` (Windows), `⌘ 1` (macOS), `⌘ 1` (IntelliJ IDEA Classic (macOS)), `⌘ 1` (macOS System Shortcuts), `Alt+1` (XWin), `Alt+1` (GNOME), `Alt+1` (KDE), `Alt+1` (Emacs), `Alt+1` (Sublime Text), `⌘ 1` (Sublime Text (macOS)), `Ctrl+1` (NetBeans), `Ctrl+Alt+L` (Visual Studio), `⌘ ⌥ L` (Visual Studio (macOS)), `Alt+1` (Eclipse), `Alt+1` (Eclipse (macOS))) on the left side of the IDE displays the project structure. You can use it to open any file in your project, create new files, and so on.

![Project view](https://resources.jetbrains.com.cn/help/img/idea/2026.2/rm_get_started_navigate_project_view.png)

### Go to declaration

Go to declaration allows you to navigate to the declaration of a symbol from any symbol usage. To see this capability in action, press `Ctrl+Shift+N` (Windows), `⌘ ⇧ O` (macOS), `⌘ ⇧ N` (IntelliJ IDEA Classic (macOS)), `⌘ ⇧ O` (macOS System Shortcuts), `Ctrl+Shift+N` (XWin), `Ctrl+Shift+N` (GNOME), `Ctrl+Shift+N` (KDE), `Ctrl+X, Ctrl+F` (Emacs), `Ctrl+P` (Sublime Text), `⌘ P` (Sublime Text (macOS)), `Alt+Shift+O` (NetBeans), `Ctrl+Shift+T` (Visual Studio), `⌘ ⇧ T` (Visual Studio (macOS)), `Ctrl+Shift+R` (Eclipse), `⌘ ⇧ R` (Eclipse (macOS)), start typing `users_controller`, select the `users_controller.rb` file and press `Enter` (Windows), `⏎` (macOS), `⏎` (IntelliJ IDEA Classic (macOS)), `⏎` (macOS System Shortcuts), `Enter` (XWin), `Enter` (GNOME), `Enter` (KDE), `Enter` (Emacs), `Enter` (Sublime Text), `⏎` (Sublime Text (macOS)), `Enter` (NetBeans), `Enter` (Visual Studio), `⏎` (Visual Studio (macOS)), `Enter` (Eclipse), `⏎` (Eclipse (macOS)).

![Go to file](https://resources.jetbrains.com.cn/help/img/idea/2026.2/ij_ruby_get_started_go_to_file.png)

In the opened `users_controller.rb` file, place the caret next to the `User` class and press `Ctrl+B` (Windows), `⌘ B` (macOS), `⌘ B` (IntelliJ IDEA Classic (macOS)), `⌘ B` (macOS System Shortcuts), `Ctrl+B` (XWin), `Ctrl+B` (GNOME), `Ctrl+B` (KDE), `Ctrl+Alt+G` (Emacs), `F12` (Sublime Text), `F12` (Sublime Text (macOS)), `Ctrl+B` (NetBeans), `F12` (Visual Studio), `F12` (Visual Studio (macOS)), `F3` (Eclipse), `F3` (Eclipse (macOS)).

[Video](https://resources.jetbrains.com.cn/help/img/idea/2026.2/rm_get_started_navigate_go_declaration.mp4)

You'll jump to the class declaration in the `user.rb` file.

Note that you can jump not only to project entities but to definitions within external libraries (which are gems in our case). For instance, keeping `Ctrl` (Windows), `Ctrl` (macOS), `Ctrl` (IntelliJ IDEA Classic (macOS)), `Ctrl` (macOS System Shortcuts), `Ctrl` (XWin), `Ctrl` (GNOME), `Ctrl` (KDE), `Ctrl` (Emacs), `Ctrl` (Sublime Text), `Ctrl` (Sublime Text (macOS)), `Ctrl` (NetBeans), `Ctrl` (Visual Studio), `Ctrl` (Visual Studio (macOS)), `Ctrl` (Eclipse), `Ctrl` (Eclipse (macOS)) pressed, hover over the `has_many` method. When the method turns into a hyperlink, click it without releasing the key.

IntelliJ IDEA will open the method definition within the ActiveRecord Rails module.

### Find usages

Let’s try the Find Usages action. In the `users_controller.rb` file, scroll down to the `edit` method, place the caret next to it and press `Alt+F7` (Windows), `⌥ F7` (macOS), `⌥ F7` (IntelliJ IDEA Classic (macOS)), `⌃ U` (macOS System Shortcuts), `Alt+F7` (XWin), `Alt+Shift+7` (GNOME), `Alt+Shift+7` (KDE), `Alt+F7` (Emacs), `Alt+F7` (Sublime Text), `⌥ F7` (Sublime Text (macOS)), `Alt+F7` (NetBeans), `Shift+F12` (Visual Studio), `⇧ F12` (Visual Studio (macOS)), `Ctrl+G` (Eclipse), `⌘ ⇧ G` (Eclipse (macOS)). In the Find window, you can explore the places where this action is used.

![Find Usages](https://resources.jetbrains.com.cn/help/img/idea/2026.2/rm_get_started_find_usages.png)

### Navigate between Rails entities

When working on a specific Rails entity, like a controller, you can navigate to the related view, model, test, or helper. Place the caret next to the `edit` method, press `Ctrl+Alt+Home` (Windows), `⌘ ⌃ ↑` (macOS), `⌘ ⌥ Home` (IntelliJ IDEA Classic (macOS)), `⌘ ⌃ ↓` (macOS System Shortcuts), `Ctrl+Alt+Home` (XWin), `Ctrl+Alt+Home` (GNOME), `Ctrl+Alt+Home` (KDE), `Ctrl+Alt+Home` (Emacs), `Ctrl+Alt+Home` (Sublime Text), `Ctrl+Alt+Home` (Sublime Text (macOS)), `Ctrl+Alt+Home` (NetBeans), `Ctrl+Alt+F7` (Visual Studio), `⌘ ⇧ F7` (Visual Studio (macOS)), `Ctrl+Alt+Home` (Eclipse), `⌘ ⌃ ↑` (Eclipse (macOS)), and click View. IntelliJ IDEA will open the `edit.html.erb` file containing the corresponding view.

[Video](https://resources.jetbrains.com.cn/help/img/idea/2026.2/rm_get_started_navigate_open_view_from_controller.mp4)

You can use the same shortcut within a view or use the ![Navigate from view to action](https://resources.jetbrains.com.cn/help/img/idea/2026.2/ruby.icons.expui.rails.actionMethod%4014x14.svg) icon in the editor gutter to quickly go to the corresponding action.

[Video](https://resources.jetbrains.com.cn/help/img/idea/2026.2/rm_get_started_navigate_open_controller_from_view.mp4)

### Search everywhere

The next IntelliJ IDEA feature allows you to search for files, classes, symbols, or options and jump to the entity you need.

Let’s try to find the `destroy` action within `UsersController`. Press `Shift` (Windows), `Shift` (macOS), `Shift` (IntelliJ IDEA Classic (macOS)), `Shift` (macOS System Shortcuts), `Shift` (XWin), `Shift` (GNOME), `Shift` (KDE), `Shift` (Emacs), `Shift` (Sublime Text), `Shift` (Sublime Text (macOS)), `Shift` (NetBeans), `Shift` (Visual Studio), `Shift` (Visual Studio (macOS)), `Shift` (Eclipse), `Shift` (Eclipse (macOS)) twice and start typing destroy. IntelliJ IDEA lists all the found results where your query is found. Select the destroy action from UsersController and press `Enter` (Windows), `⏎` (macOS), `⏎` (IntelliJ IDEA Classic (macOS)), `⏎` (macOS System Shortcuts), `Enter` (XWin), `Enter` (GNOME), `Enter` (KDE), `Enter` (Emacs), `Enter` (Sublime Text), `⏎` (Sublime Text (macOS)), `Enter` (NetBeans), `Enter` (Visual Studio), `⏎` (Visual Studio (macOS)), `Enter` (Eclipse), `⏎` (Eclipse (macOS)).

![Search everywhere](https://resources.jetbrains.com.cn/help/img/idea/2026.2/ij_ruby_get_started_search_everywhere.png)

The `users_controller.rb` file will be opened and the caret will be placed on the definition of the `destroy` action.

## Edit code

IntelliJ IDEA provides multiple code editing features available in the editor that allow you to speed up the development process. These include [code completion](auto-completing-code.html), [refactorings](refactoring-source-code.html), [code inspections](code-inspection.html), and so on.

### Code completion

IntelliJ IDEA can help you complete the names of classes, methods, keywords, and so on. When you invoke code completion, IntelliJ IDEA analyzes the context and suggests the choices applicable to the current caret position.

For instance, open the `users_controller.rb` file and go to the `index` method declared in the `UsersController` class. Type the following code inside the method and then type dot.

```RUBY
@user = User
```

Because the `User` class is inherited from the `ApplicationRecord` module, the editor will display all inherited members.

After that, start typing `first` to filter the list and find the corresponding member from the `Querying` module, and press `Enter` (Windows), `⏎` (macOS), `⏎` (IntelliJ IDEA Classic (macOS)), `⏎` (macOS System Shortcuts), `Enter` (XWin), `Enter` (GNOME), `Enter` (KDE), `Enter` (Emacs), `Enter` (Sublime Text), `⏎` (Sublime Text (macOS)), `Enter` (NetBeans), `Enter` (Visual Studio), `⏎` (Visual Studio (macOS)), `Enter` (Eclipse), `⏎` (Eclipse (macOS)).

![Code completion](https://resources.jetbrains.com.cn/help/img/idea/2026.2/ruby_get_started_completion.png)

> **Note:**
> You can also invoke code completion manually by pressing `Ctrl+Space` (Windows), `⌃ Space` (macOS), `⌃ Space` (IntelliJ IDEA Classic (macOS)), `⌃ Space` (macOS System Shortcuts), `Ctrl+Space` (XWin), `Ctrl+Space` (GNOME), `Ctrl+Space` (KDE), `Alt+/` (Emacs), `Ctrl+Space` (Sublime Text), `⌃ Space` (Sublime Text (macOS)), `Ctrl+Space` (NetBeans), `Ctrl+Space` (Visual Studio), `⌃ Space` (Visual Studio (macOS)), `Ctrl+Space` (Eclipse), `⌃ Space` (Eclipse (macOS)).

### Intentions

Intentions help you apply various code changes quickly: convert statements for better code style, add strings to locale dictionaries, use language injections, and so on.

To see intentions in action, open the `user.rb` file and scroll down to the `User.digest` method, which uses a multiline ternary operator `?:`. According to the [Ruby Style Guide](https://github.com/rubocop-hq/ruby-style-guide), it is preferable to replace such an operator with the `if/then/else/end` block. To do this, place the caret at this ternary expression (for instance, next to ActiveModel) and press `Alt+Enter` (Windows), `⌥ ⏎` (macOS), `⌥ ⏎` (IntelliJ IDEA Classic (macOS)), `⌥ ⏎` (macOS System Shortcuts), `Alt+Enter` (XWin), `Alt+Enter` (GNOME), `Alt+Enter` (KDE), `Alt+Enter` (Emacs), `Alt+Enter` (Sublime Text), `⌥ ⏎` (Sublime Text (macOS)), `Alt+Enter` (NetBeans), `Alt+Enter` (Visual Studio), `⌥ ⏎` (Visual Studio (macOS)), `Ctrl+1` (Eclipse), `⌘ 1` (Eclipse (macOS)). Press `Enter` (Windows), `⏎` (macOS), `⏎` (IntelliJ IDEA Classic (macOS)), `⏎` (macOS System Shortcuts), `Enter` (XWin), `Enter` (GNOME), `Enter` (KDE), `Enter` (Emacs), `Enter` (Sublime Text), `⏎` (Sublime Text (macOS)), `Enter` (NetBeans), `Enter` (Visual Studio), `⏎` (Visual Studio (macOS)), `Enter` (Eclipse), `⏎` (Eclipse (macOS)) to convert a ternary operator to the `if/then/else/end` block.

![Intentions](https://resources.jetbrains.com.cn/help/img/idea/2026.2/rm_get_started_intentions.png)

> **Tip:**
> You can check your code and detect possible issues using [inspections](#inspections).

### Refactor code

Refactoring is the process of modifying source code in order to make it easier to maintain and extend, but without changing its behavior. Let’s look at some refactoring features available in IntelliJ IDEA.

Rename refactorings allow you to rename classes, methods, files, variables, and parameters with all the references to them in the code corrected accordingly. Open the `user.rb` file and scroll down to the `downcase_email` method raised in the `before_save` callback. Place the caret next to this method and press `Ctrl+Shift+I` (Windows), `⌥ Space` (macOS), `⌘ ⇧ I` (IntelliJ IDEA Classic (macOS)), `⌘ Y` (macOS System Shortcuts), `Ctrl+Shift+I` (XWin), `Ctrl+Shift+I` (GNOME), `Ctrl+Shift+I` (KDE), `Ctrl+Shift+I` (Emacs), `Ctrl+Shift+I` (Sublime Text), `⌥ Space` (Sublime Text (macOS)), `Ctrl+Shift+I` (NetBeans), `Alt+F12` (Visual Studio), `⌥ Space` (Visual Studio (macOS)), `Ctrl+Shift+I` (Eclipse), `⌥ Space` (Eclipse (macOS)) to see its definition.

![Quick definition](https://resources.jetbrains.com.cn/help/img/idea/2026.2/rm_get_started_quick_definition.png)

Press `Escape` (Windows), `⎋` (macOS), `⎋` (IntelliJ IDEA Classic (macOS)), `⎋` (macOS System Shortcuts), `Escape` (XWin), `Escape` (GNOME), `Escape` (KDE), `Escape, Escape` (Emacs), `Escape` (Sublime Text), `⎋` (Sublime Text (macOS)), `Escape` (NetBeans), `Escape` (Visual Studio), `⎋` (Visual Studio (macOS)), `Escape` (Eclipse), `⎋` (Eclipse (macOS)), then press `Ctrl+Alt+Shift+T` (Windows), `⌃ T` (macOS), `⌘ ⌥ ⇧ T` (IntelliJ IDEA Classic (macOS)), `⌃ S` (macOS System Shortcuts), `Ctrl+Alt+Shift+T` (XWin), `Ctrl+Alt+Shift+T` (GNOME), `Ctrl+Alt+Shift+T` (KDE), `Ctrl+Alt+Shift+T` (Emacs), `Ctrl+Alt+Shift+T` (Sublime Text), `⌃ T` (Sublime Text (macOS)), `Ctrl+Alt+Shift+T` (NetBeans), `Ctrl+Shift+R` (Visual Studio), `⌘ ⇧ R` (Visual Studio (macOS)), `Ctrl+Alt+Shift+T` (Eclipse), `⌃ T` (Eclipse (macOS)). Select Rename in the Refactor This popup, which suggests various refactorings.

![Refactor this popup](https://resources.jetbrains.com.cn/help/img/idea/2026.2/rm_get_started_refactor_this.png)

In the Rename dialog, specify a new method name (lowercase_email in our case) and click Do Refactor

![Rename dialog](https://resources.jetbrains.com.cn/help/img/idea/2026.2/ij_ruby_get_started_refactor_rename_method_dialog.png)

The Refactoring Preview window will display all references to the renamed method.

![Refactor](https://resources.jetbrains.com.cn/help/img/idea/2026.2/ij_ruby_get_started_do_refactor_dialog.png)

Click Refactor to rename the method in all places.

### Reformat code

IntelliJ IDEA allows you to reformat source code to meet the requirements of your [code style](configuring-code-style.html).

Let's reformat the code of the `user.rb` file. Open this file and press `Ctrl+Alt+L` (Windows), `⌘ ⌥ L` (macOS), `⌘ ⌥ L` (IntelliJ IDEA Classic (macOS)), `⌘ ⌥ L` (macOS System Shortcuts), `Ctrl+Alt+L` (XWin), `Ctrl+Alt+L` (GNOME), `Alt+Shift+L` (KDE), `Ctrl+Alt+L` (Emacs), `Ctrl+Alt+L` (Sublime Text), `⌘ ⌥ L` (Sublime Text (macOS)), `Alt+Shift+F` (NetBeans), `Ctrl+Alt+Enter` (Visual Studio), `⌘ ⌥ ⏎` (Visual Studio (macOS)), `Ctrl+Alt+L` (Eclipse), `⌘ ⇧ F` (Eclipse (macOS)).

[Video](https://resources.jetbrains.com.cn/help/img/idea/2026.2/rm_get_started_reformat_code.mp4)

IntelliJ IDEA will reformat the entire file and display a number of changed lines.

## Analyze code

In this part, we’ll perform static code analysis and detect problems.

IntelliJ IDEA supports multiple inspection types and, moreover, allows displaying [RuboCop](http://rubocop.readthedocs.io/) offenses inside the IDE. The RuboCop inspection is enabled in IntelliJ IDEA by default and requires the [RuboCop gem](https://docs.rubocop.org/rubocop/installation.html) to be added to the . module SDK.

Procedure: Add and install RuboCop gem

1. Open the `Gemfile` containing a list of gems used by the application.

2. Add `gem 'rubocop', require: false` inside `group :development do`.

3. Hover the added line and click Install missing gems using 'bundler'.

Procedure: Use RuboCop

1. In the `Gemfile` file, hover the `active_storage_validations` gem.

![Rubocop warning](https://resources.jetbrains.com.cn/help/img/idea/2026.2/rm_get_started_inspection_gemfile_tooltip.png)

IntelliJ IDEA will display a Rubocop notification suggesting that you sort the gems in the alphabetical order (refer to [OrderedGems](https://www.rubydoc.info/gems/rubocop/RuboCop/Cop/Bundler/OrderedGems)).

2. In the notification, click Fix [Bundler/Ordered Gems] offenses.

3. You can also check the entire project and display all warnings in a single report. To do this, select `Code | Inspect Code` in the main menu. In the invoked dialog, you can specify the required inspection scope.

![Inspection scope](https://resources.jetbrains.com.cn/help/img/idea/2026.2/rm_get_started_inspection_scope.png)

4. Leave the Whole project option and click Analyze. The inspection results window will show warnings for a whole project.

![Inspection results](https://resources.jetbrains.com.cn/help/img/idea/2026.2/rm_get_started_inspection_result.png)

You can navigate through this report and fix or suppress specific warnings.

## Run tests

IntelliJ IDEA enables you to use different [testing frameworks](testing-frameworks.html) such as Minitest, RSpec or Cucumber.

### Run all tests

Our project contains Minitest tests in the `test` folder. To run all tests, open the Project view by pressing `Alt+1` (Windows), `⌘ 1` (macOS), `⌘ 1` (IntelliJ IDEA Classic (macOS)), `⌘ 1` (macOS System Shortcuts), `Alt+1` (XWin), `Alt+1` (GNOME), `Alt+1` (KDE), `Alt+1` (Emacs), `Alt+1` (Sublime Text), `⌘ 1` (Sublime Text (macOS)), `Ctrl+1` (NetBeans), `Ctrl+Alt+L` (Visual Studio), `⌘ ⌥ L` (Visual Studio (macOS)), `Alt+1` (Eclipse), `Alt+1` (Eclipse (macOS)). Then, right-click the `test` folder and select `Run 'All tests in test'` from the context menu.

![Run all tests in a directory](https://resources.jetbrains.com.cn/help/img/idea/2026.2/ruby_runAllTests.png)

IntelliJ IDEA will run and display test results in the Run tool window.

[Video](https://resources.jetbrains.com.cn/help/img/idea/2026.2/rm_get_started_tests_result.mp4)

### Run specific tests

Now let’s see how to run a specific test. Open the `users_controller_test.rb` file, scroll down to the `should redirect index when not logged in` test, and click the Run button on the left gutter next to this test.

![Run a specific test](https://resources.jetbrains.com.cn/help/img/idea/2026.2/rm_get_started_tests_run_specific.png)

In the invoked menu, select Run ‘Minitest: test_should_...’. IntelliJ IDEA will display the result for this test.

![Test result](https://resources.jetbrains.com.cn/help/img/idea/2026.2/ruby_get_started_tests_result_specific.png)

### Rerun failed tests

Now let’s go back to `users_controller_test.rb` and break two tests. For the `should get new` and `should redirect index when not logged in` tests, comment out the `get signup_path` and `get users_path` lines. To do this, select these lines and use the `Ctrl+/` (Windows), `⌘ /` (macOS), `⌘ /` (IntelliJ IDEA Classic (macOS)), `⌘ /` (macOS System Shortcuts), `Ctrl+/` (XWin), `Ctrl+/` (GNOME), `Ctrl+/` (KDE), `Alt+;` (Emacs), `Ctrl+/` (Sublime Text), `⌘ /` (Sublime Text (macOS)), `Ctrl+/` (NetBeans), `Ctrl+Alt+/` (Visual Studio), `⌘ ⌥ /` (Visual Studio (macOS)), `Ctrl+/` (Eclipse), `⌘ /` (Eclipse (macOS)) shortcut.

![Broken tests](https://resources.jetbrains.com.cn/help/img/idea/2026.2/rm_get_started_tests_break.png)

Run all tests again as described in [Run all tests](#all_tests). You can see now that these tests failed.

![Failed tests](https://resources.jetbrains.com.cn/help/img/idea/2026.2/rm_get_started_tests_rerun_failed.png)

Let’s fix these tests in the currently opened `users_controller_test.rb` file by uncommenting the same lines: `get signup_path` and `get users_path`. Use the same `Ctrl+/` (Windows), `⌘ /` (macOS), `⌘ /` (IntelliJ IDEA Classic (macOS)), `⌘ /` (macOS System Shortcuts), `Ctrl+/` (XWin), `Ctrl+/` (GNOME), `Ctrl+/` (KDE), `Alt+;` (Emacs), `Ctrl+/` (Sublime Text), `⌘ /` (Sublime Text (macOS)), `Ctrl+/` (NetBeans), `Ctrl+Alt+/` (Visual Studio), `⌘ ⌥ /` (Visual Studio (macOS)), `Ctrl+/` (Eclipse), `⌘ /` (Eclipse (macOS)) shortcut. We can now rerun only these failed tests using the ![Rerun Failed Tests](https://resources.jetbrains.com.cn/help/img/idea/2026.2/app.expui.run.restartFailedTests.svg) button.

[Video](https://resources.jetbrains.com.cn/help/img/idea/2026.2/rm_get_started_tests_result_success.mp4)

Now we are ready to run our application.

## Create a run/debug configuration

To run and debug our Rails application, we need to create a corresponding Rails configuration.

Press `Ctrl+Shift+A` (Windows), `⌘ ⇧ A` (macOS), `⌘ ⇧ A` (IntelliJ IDEA Classic (macOS)), `⌘ ⇧ P` (macOS System Shortcuts), `Ctrl+Shift+A` (XWin), `Ctrl+Shift+A` (GNOME), `Ctrl+Shift+A` (KDE), `Escape, X` (Emacs), `Ctrl+Shift+P` (Sublime Text), `⌘ ⇧ P` (Sublime Text (macOS)), `Ctrl+I` (NetBeans), `Ctrl+Shift+A` (Visual Studio), `⌘ ⇧ A` (Visual Studio (macOS)), `Ctrl+Shift+A` (Eclipse), `⌘ 3` (Eclipse (macOS)) and start typing edit configurations. Select Edit Configurations and press `Enter` (Windows), `⏎` (macOS), `⏎` (IntelliJ IDEA Classic (macOS)), `⏎` (macOS System Shortcuts), `Enter` (XWin), `Enter` (GNOME), `Enter` (KDE), `Enter` (Emacs), `Enter` (Sublime Text), `⏎` (Sublime Text (macOS)), `Enter` (NetBeans), `Enter` (Visual Studio), `⏎` (Visual Studio (macOS)), `Enter` (Eclipse), `⏎` (Eclipse (macOS)).

![Find Action](https://resources.jetbrains.com.cn/help/img/idea/2026.2/ij_ruby_find_action_edit_config.png)

In the invoked Run/Debug Configurations dialog, click ![Add New Configuration](https://resources.jetbrains.com.cn/help/img/idea/2026.2/app.expui.general.add.svg), start typing Rails and select it from the list.

![Run/Debug Configurations dialog](https://resources.jetbrains.com.cn/help/img/idea/2026.2/ij_ruby_run_debug_config_create.png)

Change the created configuration name to Development: sample_rails_app and click OK.

![Run/Debug Configurations dialog](https://resources.jetbrains.com.cn/help/img/idea/2026.2/ij_ruby_run_debug_config_setup.png)

For more detailed information about Rails run/debug configurations, see the [RubyMine documentation](https://www.jetbrains.com.cn/en-us/help/ruby/run-debug-configuration-rails.html).

## Run the application

To run our Rails application, press `Ctrl` (Windows), `Ctrl` (macOS), `Ctrl` (IntelliJ IDEA Classic (macOS)), `Ctrl` (macOS System Shortcuts), `Ctrl` (XWin), `Ctrl` (GNOME), `Ctrl` (KDE), `Ctrl` (Emacs), `Ctrl` (Sublime Text), `Ctrl` (Sublime Text (macOS)), `Ctrl` (NetBeans), `Ctrl` (Visual Studio), `Ctrl` (Visual Studio (macOS)), `Ctrl` (Eclipse), `Ctrl` (Eclipse (macOS)) twice and start typing `sample_rails_app`. Select the sample_rails_app_8th_ed configuration from the list and press `Enter` (Windows), `⏎` (macOS), `⏎` (IntelliJ IDEA Classic (macOS)), `⏎` (macOS System Shortcuts), `Enter` (XWin), `Enter` (GNOME), `Enter` (KDE), `Enter` (Emacs), `Enter` (Sublime Text), `⏎` (Sublime Text (macOS)), `Enter` (NetBeans), `Enter` (Visual Studio), `⏎` (Visual Studio (macOS)), `Enter` (Eclipse), `⏎` (Eclipse (macOS)).

![Run Anything / run configuration](https://resources.jetbrains.com.cn/help/img/idea/2026.2/rm_get_started_run_any_run_config.png)

IntelliJ IDEA will show the process of preparing the application to run.

![Run tool window / run Rails application](https://resources.jetbrains.com.cn/help/img/idea/2026.2/rm_get_started_run_app_output.png)

Open your app in the browser at `http://127.0.0.1:3000` (or `http://localhost:3000`) to see our working application.

![Rails application in a browser](https://resources.jetbrains.com.cn/help/img/idea/2026.2/ij_ruby_browser.png)

## Debug the application

One of the key features of IntelliJ IDEA is debugging support. The debugger provides various ways to examine the state of a running application. You can step through your code and check variable values, set watches on variables to see when values change, and so on.

> **Tip:**
> Our sample application uses the puma web server, which default worker timeout equals 60 seconds. For debugging purposes, it can be useful to set this timeout to a larger value. To do this, open the `config/puma.rb` file and specify the worker_timeout option.

### Set a breakpoint and start debugging

First, open the `users_controller.rb` file. Set a breakpoint within the `create` method next to the line where a new user is created.

![Set a breakpoint](https://resources.jetbrains.com.cn/help/img/idea/2026.2/rm_get_started_debug_breakpoint.png)

To start debugging, press `Ctrl` (Windows), `Ctrl` (macOS), `Ctrl` (IntelliJ IDEA Classic (macOS)), `Ctrl` (macOS System Shortcuts), `Ctrl` (XWin), `Ctrl` (GNOME), `Ctrl` (KDE), `Ctrl` (Emacs), `Ctrl` (Sublime Text), `Ctrl` (Sublime Text (macOS)), `Ctrl` (NetBeans), `Ctrl` (Visual Studio), `Ctrl` (Visual Studio (macOS)), `Ctrl` (Eclipse), `Ctrl` (Eclipse (macOS)) twice and start typing `sample_rails_app`. Select the sample_rails_app_8th_ed configuration from the list, hold down the `Shift` (Windows), `Shift` (macOS), `Shift` (IntelliJ IDEA Classic (macOS)), `Shift` (macOS System Shortcuts), `Shift` (XWin), `Shift` (GNOME), `Shift` (KDE), `Shift` (Emacs), `Shift` (Sublime Text), `Shift` (Sublime Text (macOS)), `Shift` (NetBeans), `Shift` (Visual Studio), `Shift` (Visual Studio (macOS)), `Shift` (Eclipse), `Shift` (Eclipse (macOS)) key (the dialog title will change to Debug), and press `Enter` (Windows), `⏎` (macOS), `⏎` (IntelliJ IDEA Classic (macOS)), `⏎` (macOS System Shortcuts), `Enter` (XWin), `Enter` (GNOME), `Enter` (KDE), `Enter` (Emacs), `Enter` (Sublime Text), `⏎` (Sublime Text (macOS)), `Enter` (NetBeans), `Enter` (Visual Studio), `⏎` (Visual Studio (macOS)), `Enter` (Eclipse), `⏎` (Eclipse (macOS)).

The Debug tool window will show the application output.

![Debug console output](https://resources.jetbrains.com.cn/help/img/idea/2026.2/rm_get_started_debug_console_output.png)

Open a web browser on your local machine and navigate to `http://127.0 .0.1:3000`.

![Rails application in a browser](https://resources.jetbrains.com.cn/help/img/idea/2026.2/ij_ruby_browser.png)

Click the Sign up now! button. On the Sign up page, enter your credentials and click Create my account.

![User credentials](https://resources.jetbrains.com.cn/help/img/idea/2026.2/rm_get_started_debug_enter_credentials.png)

The program will stop when it reaches the breakpoint.

### Examine variables

You can now examine the application state and the values of variables.

![Stop on a breakpoint](https://resources.jetbrains.com.cn/help/img/idea/2026.2/rm_get_started_debug_stop.png)

The Threads & Variables pane displays the application threads and the corresponding call stacks. In our case, the `create` method is called in Thread 1. In the right part of the pane, you can examine variables available in the current context.

> **Tip:**
> Use the ![filter](https://resources.jetbrains.com.cn/help/img/idea/2026.2/app.expui.general.filter.svg) button to show or hide calls of methods from external libraries.

Let’s add the `user_params` variable to the list. On the right side of the pane, type `user_params` in the search field and click ![Add](https://resources.jetbrains.com.cn/help/img/idea/2026.2/app.debugger.addToWatch.svg).

Then, click the ![expand](https://resources.jetbrains.com.cn/help/img/idea/2026.2/app.actions.arrowExpand.svg) icon next to this variable and then expand the @parameters variables in the same way. You will see the user credentials specified in the Signup form.

Once the breakpoint is hit, we can step through the code.

### Step over

Step over proceeds to the next line in the current scope (for example, goes to the next line), without descending into any method calls on the way.

The `User` object is not created yet and the `@user` variable not initialized (equals `nil`).

![Breakpoint](https://resources.jetbrains.com.cn/help/img/idea/2026.2/rm_get_started_debug_before_step_over.png)

Press `F8` (Windows), `F8` (macOS), `F8` (IntelliJ IDEA Classic (macOS)), `⌘ Quote` (macOS System Shortcuts), `F8` (XWin), `F8` (GNOME), `F8` (KDE), `F8` (Emacs), `F8` (Sublime Text), `F8` (Sublime Text (macOS)), `F8` (NetBeans), `F10` (Visual Studio), `F10` (Visual Studio (macOS)), `F6` (Eclipse), `F6` (Eclipse (macOS)) or click ![Step over](https://resources.jetbrains.com.cn/help/img/idea/2026.2/app.expui.run.stepOver.svg) in the Debug tool window toolbar. The debugger will go to the next line - the `if` statement, and the `@user` variable will be initialized.

![Step over](https://resources.jetbrains.com.cn/help/img/idea/2026.2/rm_get_started_debug_after_step_over.png)

Use the ![expand](https://resources.jetbrains.com.cn/help/img/idea/2026.2/app.actions.arrowExpand.svg) icon to expand and examine @user properties.

### Step into

Step into will cause the debugger to descend into the method calls or blocks on the current line and follow them through. If there are multiple method calls or blocks, you can choose the required target.

Click ![Resume Program](https://resources.jetbrains.com.cn/help/img/idea/2026.2/app.expui.run.resume.svg) to resume program execution. Go to the browser again and create another user in the Sign up form. The script will stop when it reaches the line where a user is created.

Press `F7` (Windows), `F7` (macOS), `F7` (IntelliJ IDEA Classic (macOS)), `⌘ ;` (macOS System Shortcuts), `F7` (XWin), `F7` (GNOME), `F7` (KDE), `F7` (Emacs), `F7` (Sublime Text), `F7` (Sublime Text (macOS)), `F7` (NetBeans), `F11` (Visual Studio), `⌘ F11` (Visual Studio (macOS)), `F5` (Eclipse), `F5` (Eclipse (macOS)) or click the ![Step into](https://resources.jetbrains.com.cn/help/img/idea/2026.2/app.actions.traceInto.svg) button.

![Breakpoint](https://resources.jetbrains.com.cn/help/img/idea/2026.2/rm_get_started_debug_before_step_into.png)

The editor will set a focus on the `user_params` method. You can use arrow keys or `Tab` (Windows), `Tab` (macOS), `Tab` (IntelliJ IDEA Classic (macOS)), `Tab` (macOS System Shortcuts), `Tab` (XWin), `Tab` (GNOME), `Tab` (KDE), `Tab` (Emacs), `Tab` (Sublime Text), `Tab` (Sublime Text (macOS)), `Tab` (NetBeans), `Tab` (Visual Studio), `Tab` (Visual Studio (macOS)), `Tab` (Eclipse), `Tab` (Eclipse (macOS)) to choose the required method to step into (`new` or `user_params` in our example). Select `user_params` and press `Enter` (Windows), `⏎` (macOS), `⏎` (IntelliJ IDEA Classic (macOS)), `⏎` (macOS System Shortcuts), `Enter` (XWin), `Enter` (GNOME), `Enter` (KDE), `Enter` (Emacs), `Enter` (Sublime Text), `⏎` (Sublime Text (macOS)), `Enter` (NetBeans), `Enter` (Visual Studio), `⏎` (Visual Studio (macOS)), `Enter` (Eclipse), `⏎` (Eclipse (macOS)). The program execution will jump to the `user_params` method definition.

[Video](https://resources.jetbrains.com.cn/help/img/idea/2026.2/rm_get_started_debug_step_into_1.mp4)

If you press `F7` (Windows), `F7` (macOS), `F7` (IntelliJ IDEA Classic (macOS)), `⌘ ;` (macOS System Shortcuts), `F7` (XWin), `F7` (GNOME), `F7` (KDE), `F7` (Emacs), `F7` (Sublime Text), `F7` (Sublime Text (macOS)), `F7` (NetBeans), `F11` (Visual Studio), `⌘ F11` (Visual Studio (macOS)), `F5` (Eclipse), `F5` (Eclipse (macOS)) another time, the debugger will suggest selecting between the `params` and `require` methods from the [StrongParameters](https://api.rubyonrails.org/classes/ActionController/StrongParameters.html) module.

### Debug in console

The debugger has the Console tab that enables you to interact with a debugged application with an IRB-like console.

Start typing `user_params` in the console, select the corresponding variable, and press `Enter` (Windows), `⏎` (macOS), `⏎` (IntelliJ IDEA Classic (macOS)), `⏎` (macOS System Shortcuts), `Enter` (XWin), `Enter` (GNOME), `Enter` (KDE), `Enter` (Emacs), `Enter` (Sublime Text), `⏎` (Sublime Text (macOS)), `Enter` (NetBeans), `Enter` (Visual Studio), `⏎` (Visual Studio (macOS)), `Enter` (Eclipse), `⏎` (Eclipse (macOS)).

[Video](https://resources.jetbrains.com.cn/help/img/idea/2026.2/rm_get_started_debug_console.mp4)

The Console window will display the values of variables.

## See also

### Procedures

[Configure a Ruby interpreter](configuring-language-interpreter.html) [Project analysis](project-analysis.html) [Run applications](running-applications.html) [Debug code](debugging-code.html)

