title: Rails how to have multiple forms by putting form_for inside .each loop?
body: <p>I have a page where I list out a bunch of loans that a user has and I want a form tag around each one of those forms because they can make a payment on any of the loans that are listed.</p>
  
  <p>Here's what I have that is throwing the error "Undefined method 'loan'..."</p>
  
  <pre><code>&lt;% @loans.each do |loan| %&gt;
  
      &lt;% form_for loan add_payment_payment_path(loan) , :method =&gt; :post do |f| %&gt;                                       
          &lt;%= f.text_field :amount, :placeholder =&gt; 'Amount' %&gt;
          &lt;%= f.submit 'Make Payment', :class =&gt; 'btn btn-primary'%&gt;
      &lt;% end %&gt;
  
  &lt;% end %&gt;
  </code></pre>
  
  <p>How can i have a dynamic form_for inside my <code>@loans.each</code> loop?</p>