title: Ruby on Rails each do method.
body: <p>I am having difficulty with a ruby method on my show page. I have two models: events, and payments. I am trying to show all payments made to a particular event. </p>
  
  <p>I used this method on my show page on my events model and I was able to show the payments in array format like this ($1000 $4000 $2000)</p>
  
  <pre><code>&lt;strong&gt;Payments Made: &lt;/strong&gt;
    &lt;% @event.payments.each do |p| %&gt;
      $&lt;%= p.Payment_amount.to_s.reverse.gsub(/...(?=.)/,'\&amp;,').reverse %&gt;
    &lt;% end %&gt;
  </code></pre>
  
  <p>What I would like is to show the payments like this:</p>
  
  <p>Payment 1: $1000
  Payment 2: $4000
  Payment 3: $2000</p>
  
  <p>I appreciate the help. Thanks, in advance. </p>