small medium large xlarge

David_pragsmall
19 Jun 2008, 03:16
David Schwartz (26 posts)

When I go to http://localhost:3000/admin as instructed at the top of page 172, I get the following error:

NoMethodError in Admin#login

Showing layouts/store.html.erb where line #24 raised:

You have a nil object when you didn't expect it!
The error occurred while evaluating nil.items

Extracted source (around line #24):

21:     <div id="side">
22:       <!-- START_HIGHLIGHT -->
23:       <!-- START:hidden_div -->
24:       <% hidden_div_if(@cart.items.empty?, :id => "cart") do %>
25:         <%= render(:partial => "cart", :object => @cart) %>
26:       <% end %>
27:     <!-- END:hidden_div -->

I don’t understand why we’d expect to see the banner and sidebar. Is this related ot the ‘layout “store”’ statement that was inserted? This isn’t explained.

Thanks, David

Generic-user-small
19 Jun 2008, 04:34
Donald Craig (2 posts)

To fix the error, you need to add an “if @cart” conditional around the “hidden_div_if” block. See pages 174 and 175 of B1.3.

Regards, Donald.

You must be logged in to comment