<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:atom="http://www.w3.org/2005/Atom" version="2.0">
  <channel>
    <title>Recent Posts in 'Error after adding 'layout "store" ' to application.rb' | Pragmatic Forums</title>
    <link>https://forums.pragprog.com/forums/66/topics/540</link>
    <language>en-us</language>
    <ttl>60</ttl>
    <description></description>
    <item>
      <title>Error after adding 'layout &amp;quot;store&amp;quot; ' to application.rb posted by Sam Ruby @ Fri, 13 Jun 2008 21:32:56 -0000</title>
      <description>&lt;p&gt;My apologizes.  Those lines are present on page 175 (and the text on page 174 tells you that you need to make these changes), but there aren&amp;#8217;t little triangles next to these two lines to draw your attention to them.&lt;/p&gt;


	&lt;p&gt;This will be corrected in the next beta.&lt;/p&gt;</description>
      <pubDate>Fri, 13 Jun 2008 21:32:56 -0000</pubDate>
      <guid isPermaLink="false">forums.pragprog.com:66:540:3169</guid>
      <author>Sam Ruby</author>
      <link>https://forums.pragprog.com/forums/66/topics/540</link>
    </item>
    <item>
      <title>Error after adding 'layout &amp;quot;store&amp;quot; ' to application.rb posted by Dan Steinicke @ Fri, 13 Jun 2008 18:59:23 -0000</title>
      <description>&lt;p&gt;I finally solved this.  views/layouts/store.html.erb was missing an &amp;#8220;if&amp;#8221; statement before the hidden_div_if that was causing the error.  By inserting this line:&lt;/p&gt;


	&lt;p&gt;&amp;lt;% if @cart %&amp;gt;&lt;/p&gt;


	&lt;p&gt;before line 16 above, line 16 is prevented from running when the @cart is not set.  (I also had to add an additional &amp;lt;% end %&amp;gt;).&lt;/p&gt;</description>
      <pubDate>Fri, 13 Jun 2008 18:59:23 -0000</pubDate>
      <guid isPermaLink="false">forums.pragprog.com:66:540:3168</guid>
      <author>Dan Steinicke</author>
      <link>https://forums.pragprog.com/forums/66/topics/540</link>
    </item>
    <item>
      <title>Error after adding 'layout &amp;quot;store&amp;quot; ' to application.rb posted by Dan Steinicke @ Fri, 13 Jun 2008 15:04:34 -0000</title>
      <description>&lt;p&gt;I&amp;#8217;ve been enjoying the book and learning a lot but now I&amp;#8217;m stuck.  Could someone help me understand what is going wrong and how I can fix this?  (I don&amp;#8217;t think this is an issue with the book, I think I made a mistake somewhere.)&lt;/p&gt;


	&lt;p&gt;On page 174, the beginning of the F4 iteration the book(B.13) instructs you to add the line:&lt;/p&gt;


	&lt;p&gt;layout &amp;#8220;store&amp;#8221;&lt;/p&gt;


	&lt;p&gt;to the top of controllers/application.rb.  When I do this I start getting the error below when visiting the admin page.  It looks like the cart is set to nil.  In the server console I see messages indicating that the AdminController is run, but no message saying the StoreController is run.  If the StoreController isn&amp;#8217;t running it makes sense that the cart isn&amp;#8217;t getting set, but beyond that I am lost as how to troubleshoot &amp;#38; fix this, ie why the StoreController isn&amp;#8217;t running or how the cart is supposed to get set some other way.&lt;/p&gt;


	&lt;p&gt;Here is the activity in my server console showing the error and proceeding actions:&lt;/p&gt;


	&lt;ul&gt;
	&lt;li&gt;Mongrel 1.1.5 available at 0.0.0.0:3000&lt;/li&gt;
		&lt;li&gt;Use &lt;span class="caps"&gt;CTRL&lt;/span&gt;-C to stop.&lt;/li&gt;
	&lt;/ul&gt;


	&lt;p&gt;Processing AdminController#index (for 127.0.0.1 at 2008-06-13 07:19:55) [GET]
  Session ID: 50e435f623f4a84b2d6d45875d4e52d4
  Parameters: {&amp;#8220;action&amp;#8221;=&amp;gt;&amp;#8221;index&amp;#8221;, &amp;#8220;controller&amp;#8221;=&amp;gt;&amp;#8221;admin&amp;#8221;}
  User Columns (0.001503)   &lt;span class="caps"&gt;SHOW FIELDS FROM&lt;/span&gt; `users`
  User Load (0.000159)   &lt;span class="caps"&gt;SELECT&lt;/span&gt; * &lt;span class="caps"&gt;FROM&lt;/span&gt; `users` &lt;span class="caps"&gt;WHERE&lt;/span&gt; (`users`.`id` &lt;span class="caps"&gt;IS NULL&lt;/span&gt;) LIMIT 1&lt;br /&gt;Redirected to &lt;a href="http://127.0.0.1:3000/admin/login"&gt;http://127.0.0.1:3000/admin/login&lt;/a&gt;&lt;br /&gt;Filter chain halted as [:authorize] rendered_or_redirected.&lt;br /&gt;Completed in 0.01228 (81 reqs/sec) | DB: 0.00402 (32%) | 302 Found [&lt;a href="http://127.0.0.1/admin"&gt;http://127.0.0.1/admin&lt;/a&gt;]&lt;/p&gt;


	&lt;p&gt;Processing AdminController#login (for 127.0.0.1 at 2008-06-13 07:19:55) [GET]
  Session ID: 50e435f623f4a84b2d6d45875d4e52d4
  Parameters: {&amp;#8220;action&amp;#8221;=&amp;gt;&amp;#8221;login&amp;#8221;, &amp;#8220;controller&amp;#8221;=&amp;gt;&amp;#8221;admin&amp;#8221;}&lt;br /&gt;Rendering template within layouts/store&lt;br /&gt;Rendering admin/login&lt;/p&gt;


	&lt;p&gt;ActionView::TemplateError (You have a nil object when you didn&amp;#8217;t expect it!&lt;br /&gt;The error occurred while evaluating nil.items) on line #16 of layouts/store.html.erb:&lt;br /&gt;&lt;pre&gt;
13:   &amp;lt;/div&amp;gt;
14:   &amp;lt;div id="columns"&amp;gt;
15:     &amp;lt;div id="side"&amp;gt;
16:       &amp;lt;% hidden_div_if(@cart.items.empty?, :id =&amp;gt; "cart") do %&amp;gt; 
17:         &amp;lt;%= render(:partial =&amp;gt; "cart", :object =&amp;gt; @cart) %&amp;gt;
18:       &amp;lt;% end %&amp;gt; 
19:       &amp;lt;a href="http://www...."&amp;gt;Home&amp;lt;/a&amp;gt;&amp;lt;br/&amp;gt;
&lt;/pre&gt;&lt;/p&gt;</description>
      <pubDate>Fri, 13 Jun 2008 15:04:34 -0000</pubDate>
      <guid isPermaLink="false">forums.pragprog.com:66:540:3166</guid>
      <author>Dan Steinicke</author>
      <link>https://forums.pragprog.com/forums/66/topics/540</link>
    </item>
  </channel>
</rss>
