RubyMine 5.4.0 Web Help

1.1+

RubyMine provides file templates for most of the languages that it supports. This lets you create the files with the initial content appropriate for the file purpose. For example, there are file templates for Ruby classes and scripts, Rails application elements, HAML, RJX and other supported file types.

Generally, the file name extension for a template-based file is set automatically so you don't need to specify it. For example, if you create a Ruby or Rails script, the new file automatically gets the .rb extension; if you create a view, the new file gets the .html.erb extension.

Note that Ruby class names should begin with a capital letter and can use camel case. In the corresponding file names (which are generated using the class names), the underscores will be used instead of the camel case letters.

Note

For creating Rails application elements, use the Rails generator.

To create a new file from a template
  1. In the Project tool window, select the directory in which you want to create a new file. Choose File | New or press Alt+InsertAlt+Insert.

    Alternatively, right-click the corresponding directory and select New from the context menu.

  2. Select the desired file type. Generally, all the options except File and Directory correspond to using a file template.

    Note

    An existing file template may be missing from the list if this is a custom template whose file name extension (template extension) does not match registered patterns of any of the recognized file types. In such a case, you may want to register the corresponding pattern for an existing recognized file type or add a new file type and register the corresponding pattern for this new type. For more information, see Creating and Registering File Types.

  3. In the dialog that opens, type the name of the file in the corresponding field. Note that you should not type the file name extension.

    Specify other information as required. For example, you may be asked to define the values of custom variables if the corresponding file template contains such variables and their values are not currently set.

See Also

Concepts:

Procedures:

Reference:

Web Resources: