Topic: silly view problem
I'm sorry for the silly questions.
The problem is about the invoice/show/id page it was great until i created a second order and invoice, then the
@customer.stuff displayed twice, I created a third order and invoice, hence display's three times. I only want it to diplay once. I thought it might be because invoice belongs_to customer so i tried displaying order.stuff (invoice also belongs_to order) and it only displayed just once.
This is the part of the view;
<% for invoice in @customer.invoices %>
<p><strong>Invoice to:</strong></p>
<p><%= @customer.name %>
<p><%= @customer.address %>
<% end %>
And this is part of the invoice controller;
def show
@invoice = Invoice.find(params[:id])
@invoice_item = @invoice.invoice_items
@items = @invoice.items
@customer = @invoice.customer
@order = @invoice.order
end
Am I totally off track? Oh, I mean off the rails?
Any help is very much appreciated.