# NoMethodError in StoreController#add\_to\_cart

**URL:** <https://www.ruby-forum.com/t/nomethoderror-in-storecontroller-add-to-cart/166301>\
**Category:** Rails\
**Created:** [April 23, 2009, 6:11pm UTC](https://www.ruby-forum.com/t/nomethoderror-in-storecontroller-add-to-cart/166301 "2009-04-23T18:11:41Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![vfcforums](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/v/85e7bf/32.png) [@vfcforums](https://www.ruby-forum.com/u/vfcforums)\
**Post date:** [April 23, 2009, 6:11pm UTC](https://www.ruby-forum.com/t/nomethoderror-in-storecontroller-add-to-cart/166301/1 "2009-04-23T18:11:41Z")

</div>

Working through the Agile Web D. w/ Rails book on p114. I can  
add single items of each to the cart but when I try to add a second item  
I get the following error:

NoMethodError in StoreController#add\_to\_cart

You have a nil object when you didn’t expect it!  
You might have expected an instance of Array.  
The error occurred while evaluating nil.+

Any idea why this is happening? Thanks.

Frank.
