Activity 1

Experiment with the following expressions:
  • Addition: <%= 1+2 %>
  • Concatenation: <%= "cow" + "boy" %>
  • Time in one hour: <%= 1.hour.from_now %>

Hint: pay close attention to the time zone as it will be reported in Universal Coordinated Time, some times referred to as GMT.

Discuss

Activity 2

A call to the following Ruby method returns a list of all the files in the current directory: @files = Dir.glob('*')

Use it to set an instance variable in a controller action, and then write the corresponding template that displays the filenames in a list on the browser.

Hint: you can iterate over a collection using something like this:

<% for file in @files %> file name is: <%= file %> <% end %>

Hint You might want to use a <ul> for the list.

Discuss (contains spoilers)