small medium large xlarge

29 Aug 2016, 23:09
lee manseau (5 posts)

Good day,

I am currently on pg 178 (PDF) and everything looks great, however, I went to add new products on my» localhost:3000/products page and I was hit with a hard error. Undefined method `line_items’ for nil:NilClass. ( <%= hidden_div_if(@cart.line_items.empty?, id: ‘cart’) do %> ) It appears the hidden_div_if helper that was added on page 168 works very well for the application.html.erb on the main page but not for the add products page. Has anyone found a successful solution to this?

Thanks, Lee

30 Aug 2016, 02:28
Sam Ruby (634 posts)

Add <% if @cart %> and <% end %> back in around the <% hidden_div_if .. do%> .. <% end %> code.

This will be fixed in the next printing.

30 Aug 2016, 15:49
lee manseau (5 posts)

Perfect!!!! Thank you Sam Ruby

You must be logged in to comment