The Extract Partial refactoring allows you to remove duplication in a view by extracting its fragment to a partial view. You can apply this refactoring to .html.erb and .html.haml files.
To extract a view fragment to a partial view, do the following:
Open a view in the editor and select the valid code fragment. For example, in case of HTML, your selection must contain matching opening and closing tags.
From the main menu, or from the context menu of the selection, select.
In the Extract Partial dialog, specify the desired partial view name without the extension and leading underscore, and click OK.
RubyMine will move the selected code fragment and replace it with a corresponding call.