Using Embedded Ruby (ERB)

Using Embedded Ruby (ERB)

ERB allows embedding Ruby code into HTML templates. These templates are saved with the .html.erb extension in app/views.

  • <%= %> evaluates and displays the result.
  • <% %> evaluates without displaying.

Example: <%= @article.title %>

← PrevNext →