Got NoMethodError although the instant variable exist

Hi all,

When i access localhost:3000/home , got this NoMethodError

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

Extracted source (around line #86):

83:
84:
85:


86: <%= hidden_div_if(@cart.items.empty?, :id => “cart”) %>

87: <%= render(:partial => “store/cart”, :object => @cart) %>
88:


89:

Here’s the controller’s action:
def show_page
load_data
@cart = find_cart
@page = Page.find_by_name(params[:name])
unless @page.is_a? Page
redirect_to_index(“Halaman tidak ada”)
end
end

Here’s the Application Trace:

app/views/layouts/store.rhtml:86:in
_run_rhtml_47app47views47layouts47store46rhtml' app/controllers/sessions_controller.rb:24:increate’

sessions_controller is a controller from RESTful authentication (which i
was
just installed, never got error like this before). I added @cart =
find_cart
in its ‘new’ method. Here’s the find_cart :

def find_cart
session[:cart] ||= Cart.new
end

I’m wondering why i got the error?

Thanks,

Dida