Creating Views from Actions
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.
To create a view for a method
- 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 exist, RubyMine informs that the corresponding view is not found, and suggests to create a new one:
Edit view contents as required. Note that you can insert Ruby code in view, surrounded with the
%>characters. Refer to the section Injecting Ruby Code in View for details.
Last modified: 1 September 2016