title: rails - adding html div tags while looping through array
body: <p>I'm trying to display a conversation in my <code>html.erb</code> file.</p>
  
  <p>I'm using a specific template and want to copy their chat section.</p>
  
  <p>Here's the chat section:</p>
  
  <p><a href="http://webapplayers.com/inspinia_admin-v2.7.1/chat_view.html" rel="nofollow noreferrer">http://webapplayers.com/inspinia_admin-v2.7.1/chat_view.html</a></p>
  
  <p>I noticed that their chat "bubbles" are just different divs.</p>
  
  <p>Like this:</p>
  
  <pre><code> &lt;div class="chat-message left"&gt;
      &lt;img class="message-avatar" src="&lt;%= image_path('a1.jpg') %&gt;" alt=""&gt;
      &lt;div class="message"&gt;
          &lt;a class="message-author" href="#"&gt; Michael Smith &lt;/a&gt;
          &lt;span class="message-date"&gt; Mon Jan 26 2015 - 18:39:23 &lt;/span&gt;
              &lt;span class="message-content"&gt;
                  Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat.
              &lt;/span&gt;
      &lt;/div&gt;
  &lt;/div&gt;
  
  &lt;div class="chat-message right"&gt;
      &lt;img class="message-avatar" src="&lt;%= image_path('a4.jpg') %&gt;" alt=""&gt;
      &lt;div class="message"&gt;
          &lt;a class="message-author" href="#"&gt; Karl Jordan &lt;/a&gt;
          &lt;span class="message-date"&gt;  Fri Jan 25 2015 - 11:12:36 &lt;/span&gt;
              &lt;span class="message-content"&gt;
                  Many desktop publishing packages and web page editors now use Lorem Ipsum as their default model text, and a search for 'lorem ipsum' will uncover.
              &lt;/span&gt;
      &lt;/div&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>If i have an array of @messages in my <code>html.erb</code> file, how can I traverse the array and for every message add one of those div sections in order to make my chat view?</p>
  
  <p>Alternatively, I will have to put it in some sort of table with each row styled depending on whether the message is incoming or outbound.</p>