I'm building a small app where a user can make entries into a text box, press enter and then the string they entered will be recorded in a section below the text box.
The things the person enters, called Lessons
are displayed in the bottom of the page with the following code.
<% @allLessons.each do |lesson| %>
<tr>
<td class="my-lessons">
<b><%= lesson.content %></b> – <%= lesson.created_at.strftime("%b %d, %Y") %>
<br />
</td>
</tr>
<% end %>
I'm trying to write something that looks at the date of each lesson and if that date is greater than the previous day's date, it inserts a line break between the outputted entries.
I'm very puzzled on how to do this. Would it be best to do all embedded Ruby in home.html.erb
or use the pages controller
to help out here as well?