# Create Rails application elements

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

RubyMine helps you populate Rails applications with the stubs of all the required elements: controllers, views, models, and so on. You can launch Rails generators in several ways:

Procedure:

* 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` (Visual Studio), `Ctrl` (Visual Studio (macOS)), `Ctrl` (TextMate), `Ctrl` (NetBeans), `Ctrl` (Eclipse), `Ctrl` (Eclipse (macOS)) twice and start typing a required command or its part (for example, rails g controller). Then, select this command from the suggestion 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` (Visual Studio), `⏎` (Visual Studio (macOS)), `Enter` (TextMate), `Enter` (NetBeans), `Enter` (Eclipse), `⏎` (Eclipse (macOS)).

* Use the `Tools | Run Rails Generator` menu command.

* In the main menu, go to `File | New` `Alt+Insert` (Windows), `⌘ N` (macOS), `⌃ N` (IntelliJ IDEA Classic (macOS)), `⌘ N` (macOS System Shortcuts), `Alt+Insert` (XWin), `Alt+Insert` (GNOME), `Alt+Insert` (KDE), `Alt+Insert` (Emacs), `Alt+Insert` (Sublime Text), `⌘ N` (Sublime Text (macOS)), `Alt+Insert` (Visual Studio), `⌘ ⌃ N` (Visual Studio (macOS)), `Ctrl+N` (TextMate), `Alt+Insert` (NetBeans), `Alt+Insert` (Eclipse), `⌘ N` (Eclipse (macOS)) and select Rails Generator.

In this topic, we’ll show you several examples on how to create Rails application elements.

[Video](https://www.youtube.com/v/-vEGl4dAG_E)

## Create controllers and actions

To generate a controller and optionally its actions, do the following:

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` (Visual Studio), `Ctrl` (Visual Studio (macOS)), `Ctrl` (TextMate), `Ctrl` (NetBeans), `Ctrl` (Eclipse), `Ctrl` (Eclipse (macOS)) twice and start typing rails g controller. Select `rails g controller` 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` (Visual Studio), `⏎` (Visual Studio (macOS)), `Enter` (TextMate), `Enter` (NetBeans), `Enter` (Eclipse), `⏎` (Eclipse (macOS)).

2. In the invoked Add New Controller dialog, specify the controller name. Optionally, add the action names separated by spaces (for example, new create). Click OK.

![Add New Controller](https://resources.jetbrains.com/help/img/idea/2026.3/rm_rails_elements_new_controller_dialog.png)

> **Tip:**
> Additional options allow you to provide additional arguments. For example, you can add the --no-test-framework argument.

3. RubyMine generates required files (a controller, view, and other) and displays output in the Run tool window.

![Run tool window](https://resources.jetbrains.com/help/img/idea/2026.3/rm_rails_elements_new_controller_output.png)

You can click any file to quickly open it in the editor.

## Create views from actions

You can create a view for a specified controller action right in the editor. To do this:

Procedure:

1. Open a controller file in the editor.

2. Locate the desired action and click the ![View for action](https://resources.jetbrains.com/help/img/idea/2026.3/ruby.icons.rails.anyType%4012x12.svg) icon in the left gutter of the editor.

![Create view from action](https://resources.jetbrains.com/help/img/idea/2026.3/rm_rails_elements_create_view_gutter.png)

3. If a view associated with the method exists, it is opened in the editor. If a view doesn't exist, RubyMine suggests creating a new one.

![Go to view](https://resources.jetbrains.com/help/img/idea/2026.3/rm_rails_elements_create_view_dialog.png)

Specify the name of the view file and click OK. Note that you can create ERB or Haml view.

## Create models

To create a model, perform the following steps:

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` (Visual Studio), `Ctrl` (Visual Studio (macOS)), `Ctrl` (TextMate), `Ctrl` (NetBeans), `Ctrl` (Eclipse), `Ctrl` (Eclipse (macOS)) twice and start typing rails g model. Select `rails g model` 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` (Visual Studio), `⏎` (Visual Studio (macOS)), `Enter` (TextMate), `Enter` (NetBeans), `Enter` (Eclipse), `⏎` (Eclipse (macOS)).

2. In the invoked Add New Model dialog, specify the model name, attributes and its types (for example, Article title:string text:text). Click OK.

> **Tip:**
> 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)) to complete attribute types.

![Add New Model](https://resources.jetbrains.com/help/img/idea/2026.3/rm_rails_elements_new_model_dialog.png)

3. RubyMine generates required files (a model and migration) and displays output in the Run tool window.

![Run tool window](https://resources.jetbrains.com/help/img/idea/2026.3/rm_rails_elements_new_model_output.png)

You can click any file to quickly open it in the editor.

> **Tip:**
> To see a dependency diagram for the created model, press `Ctrl+Alt+Shift+U` (Windows), `⌘ ⌥ ⇧ U` (macOS), `⌘ ⌥ ⇧ U` (IntelliJ IDEA Classic (macOS)), `⌘ ⌥ ⇧ U` (macOS System Shortcuts), `Ctrl+Alt+Shift+U` (XWin), `Ctrl+Alt+Shift+U` (GNOME), `Ctrl+Alt+Shift+U` (KDE), `Ctrl+Alt+Shift+U` (Emacs), `Ctrl+Alt+Shift+U` (Sublime Text), `⌘ ⌥ ⇧ U` (Sublime Text (macOS)), `Ctrl+Alt+Shift+U` (Visual Studio), `⌘ ⌥ ⇧ U` (Visual Studio (macOS)), `Meta+Alt+Shift+U` (TextMate), `Ctrl+Alt+Shift+U` (NetBeans), `Ctrl+Alt+Shift+U` (Eclipse), `⌘ ⌥ ⇧ U` (Eclipse (macOS)), select Rails Model Dependency Diagram in the invoked popup 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` (Visual Studio), `⏎` (Visual Studio (macOS)), `Enter` (TextMate), `Enter` (NetBeans), `Enter` (Eclipse), `⏎` (Eclipse (macOS)).  Learn more at [Show a Rails model diagram](working-with-diagrams.html#model_diagram).

