<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0">
	<channel>
		<title><![CDATA[Rails Forum - Ruby on Rails Help and Discussion Forum - silly view problem]]></title>
		<link>http://railsforum.com/viewtopic.php?id=1157</link>
		<description><![CDATA[The most recent posts in silly view problem.]]></description>
		<lastBuildDate>Sat, 11 Nov 2006 05:08:40 +0000</lastBuildDate>
		<generator>PunBB</generator>
		<item>
			<title><![CDATA[Re: silly view problem]]></title>
			<link>http://railsforum.com/viewtopic.php?pid=5866#p5866</link>
			<description><![CDATA[<p>Oh, thats what i first tried but it didnt work. I must have had the wrong combination in the controller at the time. Thankyou very much for your help.</p>]]></description>
			<author><![CDATA[dummy@example.com (Miss B)]]></author>
			<pubDate>Sat, 11 Nov 2006 05:08:40 +0000</pubDate>
			<guid>http://railsforum.com/viewtopic.php?pid=5866#p5866</guid>
		</item>
		<item>
			<title><![CDATA[Re: silly view problem]]></title>
			<link>http://railsforum.com/viewtopic.php?pid=5787#p5787</link>
			<description><![CDATA[<p>You can move the customer info out of the invoices loop so it only displays once. So, instead of this:</p><p><pre name="code" class="ruby:nogutter">&lt;% for invoice in @customer.invoices %&gt;<br />&lt;p&gt;&lt;strong&gt;Invoice to:&lt;/strong&gt;&lt;/p&gt;<br />&lt;p&gt;&lt;%= @customer.name %&gt;<br />&lt;p&gt;&lt;%= @customer.address %&gt;<br />&lt;% end %&gt;</pre><br />Do this:</p><p><pre name="code" class="ruby:nogutter">&lt;p&gt;&lt;strong&gt;Invoices to:&lt;/strong&gt;&lt;/p&gt;<br />&lt;p&gt;&lt;%= @customer.name %&gt;<br />&lt;p&gt;&lt;%= @customer.address %&gt;<br />&lt;% for invoice in @customer.invoices %&gt;<br />&nbsp; ...<br />&lt;% end %&gt;</pre></p>]]></description>
			<author><![CDATA[dummy@example.com (ryanb)]]></author>
			<pubDate>Fri, 10 Nov 2006 15:29:05 +0000</pubDate>
			<guid>http://railsforum.com/viewtopic.php?pid=5787#p5787</guid>
		</item>
		<item>
			<title><![CDATA[Re: silly view problem]]></title>
			<link>http://railsforum.com/viewtopic.php?pid=5780#p5780</link>
			<description><![CDATA[<p>I&#039;m pretty sure its a &quot;less is more&quot;.</p><p>In your invoice controller if you do this..</p><p><pre name="code" class="ruby:nogutter">&nbsp; <br />def show<br /> @invoices = Invoice.find(:all)<br />end</pre><br />you should be all set...(if your relationship stuff is connected..)</p><p>then in the view you show the invoices like this:</p><p><pre name="code" class="ruby:nogutter">&lt;% for invoice in @invoices %&gt;<br />&lt;p&gt;&lt;strong&gt;Invoice to:&lt;/strong&gt;&lt;/p&gt;<br />&lt;p&gt;&lt;%= invoice.customer.name %&gt;<br />&lt;p&gt;&lt;%= invoice.customer.address %&gt;<br />&lt;% end %&gt;</pre><br />because then each invoice is looped through 1 at a time, and you will be accessing specific information for each invoice<br />ie. invoice.customer.name</p><p>hth</p>]]></description>
			<author><![CDATA[dummy@example.com (chasC)]]></author>
			<pubDate>Fri, 10 Nov 2006 14:16:01 +0000</pubDate>
			<guid>http://railsforum.com/viewtopic.php?pid=5780#p5780</guid>
		</item>
		<item>
			<title><![CDATA[Re: silly view problem]]></title>
			<link>http://railsforum.com/viewtopic.php?pid=5775#p5775</link>
			<description><![CDATA[<p>I guess its really simple like the log says,<br />show fields from customers where invoices.customer_id = 49<br />show fields from orders where invoices.order_id = 58<br />where there is only one invoice for order 58<br />and three invoices for customer 49<br />Just not sure how to customize it to suit.<br />Thanks again.</p>]]></description>
			<author><![CDATA[dummy@example.com (Miss B)]]></author>
			<pubDate>Fri, 10 Nov 2006 11:50:54 +0000</pubDate>
			<guid>http://railsforum.com/viewtopic.php?pid=5775#p5775</guid>
		</item>
		<item>
			<title><![CDATA[silly view problem]]></title>
			<link>http://railsforum.com/viewtopic.php?pid=5774#p5774</link>
			<description><![CDATA[<p>I&#039;m sorry for the silly questions.<br />&nbsp; The problem is about the invoice/show/id page it was great until i created a second order and invoice, then the <br />@customer.stuff displayed twice, I created a third order and invoice, hence display&#039;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.<br />This is the part of the view;</p><p>&lt;% for invoice in @customer.invoices %&gt;<br />&lt;p&gt;&lt;strong&gt;Invoice to:&lt;/strong&gt;&lt;/p&gt;<br />&lt;p&gt;&lt;%= @customer.name %&gt;<br />&lt;p&gt;&lt;%= @customer.address %&gt;<br />&lt;% end %&gt;</p><p>And this is part of the invoice controller;</p><p>def show<br />&nbsp; &nbsp; @invoice = Invoice.find(params[:id])<br />&nbsp; &nbsp; @invoice_item = @invoice.invoice_items<br />&nbsp; &nbsp; @items = @invoice.items<br />&nbsp; &nbsp; @customer = @invoice.customer <br />&nbsp; &nbsp; @order = @invoice.order<br />end</p><p>Am I totally off track? Oh, I mean off the rails? <br />Any help is very much appreciated.</p>]]></description>
			<author><![CDATA[dummy@example.com (Miss B)]]></author>
			<pubDate>Fri, 10 Nov 2006 11:16:32 +0000</pubDate>
			<guid>http://railsforum.com/viewtopic.php?pid=5774#p5774</guid>
		</item>
	</channel>
</rss>
