Though a view for a controller is added by default on controller creation, it is also possible to define individual views for each public method of a controller.
- Open a controller in the editor, and locate the desired method.
Click the view icon in the left gutter of the editor:
If a view associated with the method exists, it is opened in the editor. If a view doesn't
RubyMine informs that the corresponding view is not found, and suggests to create a new one:
Specify the name of the view file. By default, RubyMine suggests .html.erb. However, you can specify .haml file as well. Click OK. The new view file opens in the editor.
- Edit view contents as required. Note that you can insert Ruby code in view, surrounded with the <% and %> characters. Refer to the section Injecting Ruby Code in View for details.