where line #3 raised:

Showing app/views/store/display_cart.rhtml where line #3 raised:

You have a nil object when you didn't expect it! You might have expected an instance of Array. The error occured while evaluating nil.size Extracted source (around line #3):

1: <h1>Display Cart</h1> 2: <p> 3: Your cart contains <%= @items.size %> items. 4: </p> RAILS_ROOT: /Users/bogdang/Documents/ruby/depot/public/../config/..

Application Trace | Framework Trace | Full Trace #{RAILS_ROOT}/app/views/store/display_cart.rhtml:3:in `_run_rhtml_store_display_cart'

How can i fix this?

Well, one way would be to ensure that @items was always an array before you get to your view, but if you just want to deal with it in the view do:

Your cart contains <%= @items.nil? ? "no items" : pluralize(@items.size, "item")) %>.

WHich would result in:

no items 1 item 2 items

depending on if there are no, 1, or 2 (or more) items in the cart.

-philip