small medium large xlarge

Generic-user-small
19 Jan 2009, 21:48
Sean Katz (1 post)

On page 177 the book indicates that if you add the layout “store” call to the application controller, that the layout will be available application wide. I have found that this has no effect for me. I have cleared all sessons, restarted the server, yet no luck. When I place this call in each of the controllers separately, it works fine. What am I missing?

Samr_small_pragsmall
20 Jan 2009, 13:29
Sam Ruby (634 posts)

Did you remove the scaffold generated layouts, as described on page 178?

Generic-user-small
06 Apr 2009, 21:40
Kostas L (2 posts)

I am also having a problem with that. Ive removed scaffold generated layouts, but when i write the layout “store” line, i am getting an exception in the store.html.erb file. The error says: You have a nil object when you didn’t expect it! The error occurred while evaluating nil.items

and it says the problem is here: Extracted source (around line #14):

11: </div> 12: <div id="columns"> 13: <div id="side"> 14: <% hidden_div_if(@cart.items.empty?, :id=>”cart”) do %> 15: <%= render(:partial=>”cart”, :object=>@cart) %> 16: <% end %> 17: <%= link_to ‘Home’, :controller => ‘store’ %>

I just cant understand whats happening… I would appreciate any help cause iam stuck! Thanks anyway!

Generic-user-small
06 Apr 2009, 21:41
Kostas L (2 posts)

I’ll try to write it again:

11:  </div>
12:  <div id="columns">
13:  <div id="side">
14:   <% hidden_div_if(@cart.items.empty?, :id=>"cart") do %>
15:     <%= render(:partial=>"cart", :object=>@cart) %>
16:     <% end %>
17:  <%= link_to 'Home', :controller => 'store' %><br/>
Generic-user-small
27 Jul 2009, 15:53
scott (1 post)

youre block should look like this:

`
 
<!-- START_HIGHLIGHT --> <!-- START:hidden_div --> <% if @cart %> <!-- This is what's failing. There's no check in the text to see if the @cart is null --> <% hidden_div_if(@cart.items.empty?, :id => "cart") do %> <%= render(:partial => "cart", :object => @cart) %> <% end %> <% end %> `
You must be logged in to comment