# Turbo

> For the complete documentation index, see [llms.txt](https://www.jetbrains.com/help/ruby/2026.3/llms.txt).

[Turbo](https://turbo.hotwired.dev/) is part of [Hotwire](https://hotwired.dev/). It enables Rails applications to update parts of a page without requiring custom JavaScript.

RubyMine provides code insight for the Ruby API of the `turbo-rails` gem in Rails views, controllers, and models. When the gem is available in the project, Turbo methods resolve like regular Ruby methods. Turbo-specific suggestions are shown in bold and sorted to the top of the completion list.

The suggestions and method signatures are derived from the version of `turbo-rails` installed in the project. Code completion appears automatically as you type. To invoke it manually, press `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` (Visual Studio), `⌃ Space` (Visual Studio (macOS)), `Ctrl+Space` (TextMate), `Ctrl+Space` (NetBeans), `Ctrl+Space` (Eclipse), `⌃ Space` (Eclipse (macOS)).

The following procedures show how to use RubyMine code insight when working with Turbo in a Rails application. They use a generated `Message` resource to demonstrate completion and navigation for Turbo Frames, Turbo Streams, and broadcasting. To learn how to implement these features in an application, refer to the [Turbo Handbook](https://turbo.hotwired.dev/handbook/introduction).

## Before you start

Procedure: Create the example resource

1. [Create a new Rails
application](new-project-wizard.html#new_rails_project) that uses Rails 7.0 or later. Make sure that the `turbo-rails` gem is included in the project.

2. Press `Ctrl` twice to open Run Anything and run:

```SHELL
rails generate scaffold Message content:text
```

The generated resource provides the model, controller, and views used as editing contexts in the following demonstrations. You do not need to run the application.

## Complete Turbo Frame helpers

RubyMine makes the Turbo view helpers available in ERB templates. Use a generated view to see how completion works for `turbo_frame_tag`.

Procedure: Complete a Turbo Frame helper

1. Open `app/views/messages/_message.html.erb`, start an ERB expression, and type `turbo_`:

RubyMine lists the Turbo helpers available in the installed gem. Turbo methods are shown in bold and sorted to the top of the completion list.

![Completion for Turbo frames](https://resources.jetbrains.com/help/img/idea/2026.3/rm_turbo_frame_support.png)

2.

3. Select `turbo_frame_tag` and complete the expression, for example:

```ERB
<%= turbo_frame_tag message do %>
  <%= message.content %>
<% end %>
```

> **Note:**
> In Rails controllers, RubyMine also resolves extensions provided by Turbo, such as `turbo_frame_request?`.

## Complete Turbo Stream actions

The `turbo_stream` helper resolves to `Turbo::Streams::TagBuilder`. RubyMine can therefore complete the stream actions supplied by the version of `turbo-rails` used in the project.

Procedure: Complete actions in a Turbo Stream template

1. Create `app/views/messages/create.turbo_stream.erb`.

> **Note:**
> The file is used only as an editing context for completion; the controller does not need to be changed for this demonstration.

2. Inside an ERB output tag (`<%= ... %>`), start typing `turbo_stream.`. RubyMine automatically displays the Turbo Stream actions available in the installed gem.

![Completion for Turbo streams](https://resources.jetbrains.com/help/img/idea/2026.3/rm_turbo_stream_completion.png)

3. Select `prepend` and complete the call:

```ERB
<%= turbo_stream.prepend "messages", @message %>
```

4. On a new line, start typing `turbo_stream.` inside another ERB output tag and select `update` from the completion list.

![Completion for Turbo streams](https://resources.jetbrains.com/help/img/idea/2026.3/rm_turbo_stream_update_completion.png)

5. Specify `"new_message"` as the target and add a block that renders a new message form:

```ERB
<%= turbo_stream.update "new_message" do %>
  <%= render "form", message: Message.new %>
<% end %>
```

> **Tip:**
> You can use the gutter icon next to a controller action to navigate to the corresponding `.turbo_stream.erb` template.

Turbo Stream actions can also be constructed directly in a controller. To demonstrate code completion in this context, add a Turbo Stream response to the generated `destroy` action. The response uses the `remove` action to remove the deleted message from the page.

Procedure: Complete a Turbo Stream action in a controller

1. Open `app/controllers/messages_controller.rb` and replace the generated `destroy` action with the following code. Leave the caret after the second `turbo_stream.`:

```RUBY
def destroy
          @message.destroy!

          respond_to do |format|
            format.turbo_stream do
              render turbo_stream: turbo_stream.
            end
            format.html do
              redirect_to messages_path,
                          status: :see_other,
                          notice: "Message was successfully destroyed."
            end
            format.json { head :no_content }
          end
        end
```

2. Press `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` (Visual Studio), `⌃ Space` (Visual Studio (macOS)), `Ctrl+Space` (TextMate), `Ctrl+Space` (NetBeans), `Ctrl+Space` (Eclipse), `⌃ Space` (Eclipse (macOS)). RubyMine displays the Turbo Stream actions available in the installed gem.

3. Select `remove` and specify `@message` as the target.

[Video](https://resources.jetbrains.com/help/img/idea/2026.3/rm_turbo_stream_remove_action.mp4)

The completed action should look as follows:

```RUBY
def destroy
          @message.destroy!

          respond_to do |format|
            format.turbo_stream do
              render turbo_stream: turbo_stream.remove(@message)
            end
            format.html do
              redirect_to messages_path,
                          status: :see_other,
                          notice: "Message was successfully destroyed."
            end
            format.json { head :no_content }
          end
        end
```

## Complete broadcasting methods

RubyMine makes the methods from `Turbo::Broadcastable` available in Rails models and gives them priority in code completion.

Procedure: Complete a broadcasting method

1. Open `app/models/message.rb` and add an `after_update_commit` callback. Inside the callback block, start typing `broadcast_`:

```RUBY
class Message < ApplicationRecord
              after_update_commit do
                broadcast_
              end
            end
```

RubyMine suggests the broadcasting methods available in the installed version of `turbo-rails`, including synchronous methods and their asynchronous `_later_to` variants.

![Code completion for Turbo broadcasting methods in a model](https://resources.jetbrains.com/help/img/idea/2026.3/rm_turbo_broadcast_completion.png)

2. Select `broadcast_replace_later_to` and specify `"messages"` as the stream name. The completed callback should look as follows:

```RUBY
class Message < ApplicationRecord
              after_update_commit do
                broadcast_replace_later_to "messages"
              end
            end
```

## Navigate and inspect Turbo methods

Because RubyMine resolves Turbo methods provided by the installed `turbo-rails` gem, you can navigate to their declarations and inspect their documentation and signatures.

Place the caret at a resolved Turbo method, such as `turbo_frame_tag`, and do one of the following:

* 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)), `F12` (Visual Studio), `F12` (Visual Studio (macOS)), `Meta+B` (TextMate), `Ctrl+B` (NetBeans), `F3` (Eclipse), `F3` (Eclipse (macOS)) to navigate to the method declaration in the gem. For `turbo_frame_tag`, RubyMine opens `app/helpers/turbo/frames_helper.rb` inside the installed gem.

* Press `Ctrl+Q` (Windows), `F1` (macOS), `⌃ J` (IntelliJ IDEA Classic (macOS)), `⌘ I` (macOS System Shortcuts), `Ctrl+Q` (XWin), `Ctrl+Q` (GNOME), `Ctrl+Q` (KDE), `Ctrl+Q` (Emacs), `Ctrl+Q` (Sublime Text), `Ctrl+Q` (Sublime Text (macOS)), `Ctrl+K, I` (Visual Studio), `⌘ K, I` (Visual Studio (macOS)), `Ctrl+Middle-Click` (TextMate), `Ctrl+Q` (NetBeans), `Alt+Middle-Click` (Eclipse), `⌥ Middle-Click` (Eclipse (macOS)) to view the method documentation.

* Press `Ctrl+P` (Windows), `⌘ P` (macOS), `⌘ P` (IntelliJ IDEA Classic (macOS)), `⌘ P` (macOS System Shortcuts), `Ctrl+P` (XWin), `Ctrl+P` (GNOME), `Ctrl+P` (KDE), `Alt+Shift+P` (Emacs), `Ctrl+P` (Sublime Text), `Ctrl+P` (Sublime Text (macOS)), `Ctrl+Shift+Space` (Visual Studio), `⌘ P` (Visual Studio (macOS)), `Meta+P` (TextMate), `Ctrl+P` (NetBeans), `Ctrl+P` (Eclipse), `⌃ ⇧ Space` (Eclipse (macOS)) inside a method call to view its signature.

[Video](https://resources.jetbrains.com/help/img/idea/2026.3/m_turbo_frame_declaration.mp4)

## Learn more

* [Turbo Frames](https://turbo.hotwired.dev/handbook/frames)

* [Turbo Streams](https://turbo.hotwired.dev/handbook/streams)

* [turbo-rails](https://github.com/hotwired/turbo-rails)

* [How to use Turbo in your Rails apps with RubyMine](https://blog.jetbrains.com/ruby/2024/07/how-to-use-turbo-in-your-rails-apps-with-rubymine/)

[Video](https://www.youtube.com/v/65OWntPXj68)

