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.
Here's what I have that is throwing the error "Undefined method 'loan'..."
<% @loans.each do |loan| %>
<% form_for loan add_payment_payment_path(loan) , :method => :post do |f| %>
<%= f.text_field :amount, :placeholder => 'Amount' %>
<%= f.submit 'Make Payment', :class => 'btn btn-primary'%>
<% end %>
<% end %>
How can i have a dynamic form_for inside my @loans.each loop?