Controller class variables not available to method partials?

Hi all,

I hope I got the title right. Here is my noob problem. I have one
controller ‘user’ and a layout for it (also ‘user’). This layout
displays 3 columns side by side:

  • a search box on the left that shows results via view in /user/search
    (through method ‘search’ in controller)
  • a display column (through :yield in the controller)
  • a shopping list of items with any changes (through a partial in the
    controller)

My problem is in the shopping list. The partial is rendered using:

 <%= render(:partial => "list", :object => @list) %>

Where @list is a controller class variable. However when I invoke the
search action I get this error:

 NoMethodError in User#search
 Showing app/views/user/_list.rhtml where line #3 raised:

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

So I guess the @list array is unavailable in the search view? Does
search not inherit from the controller? How can I make it see @list.

Thanks in advance, sorry if this is really easy,

W

<%= render(:partial => “list”, :locals => {:list => @list) %>