Ruby on Rails
Rails utilizes an MVC framework (Model, View, Controller) where the views are composed of html with embedded Ruby. These files use the dot ( . ) erb extension, which of course, stands for "embedded ruby". So, for example, an erb file may be named 'about.html.erb'. These files allow developers to add Ruby code to their web pages, which is very useful for variable substitution and flow control.
When composing "*.html.erb" files, any valid HTML can be used. Ruby code needs to be inside
<% %> braces to be interpreted correctly. For example,
<%# This is a ruby comment %>
Ruby code between the erb braces
<% %> will be executed but nothing will be displayed on the screen. There is a specific syntax to display text on the screen, which is
<%= %>. This is an important distinction. Memorize it if you'll be working with the Rails framework in any capacity.
<% %>- evaluates Ruby code
<%= %>- displays Ruby code
It's common in Rails to store an instance of the current user in a variable and then refer to that variable in the view. For example, refer to the instance as
<%= current_user.username %> to print the username to the screen. This allows developers to write something like, "Welcome back,
<%= current_user.username %>!" one time in the application yet each user will then see their own username (Note: this assumes there is a field 'username' in the User model).