RubyMine 5.4.0 Web Help

1.5+

View files contain markup and islands of Ruby code. Any text in view files will be perceived as Ruby code in the following cases:

Thus, having inserted the enclosing characters in view, you can type Ruby code, enjoying the Ruby-aware syntax and error highlighting and all sorts of coding assistance:

ruby_viewInjection.png

ruby_viewInjectionHaml.png

To inject Ruby code in a *.html.erb view, do one of the following
  • Type the opening angle bracket <, press Ctrl+SpaceCtrl+Space, and select % from the suggestion list:

    ruby_view1.png

    RubyMine automatically completes the closing characters. So doing, the caret rests in the next editing position within the <% and %> characters.

  • Press Ctrl+Shift+PeriodCtrl+Shift+Period to insert both opening and closing characters.
  • Apply one of the surround templates, using Ctrl+Alt+TCtrl+Alt+T:

    ruby_view2.png

See Also

Concepts:

Procedures:

Web Resources: