Losing arrays with partial

Not sure why this is happening.

In my index.rhtml is a form with instance variable for colleciton_selects. So in the controller -

@categories = Category.find(:all, :order => “name”)

Now I’ve changed the index.rhtml to _index.rhtml and all of a sudden I’m getting nil.inject errors. _index should still be part of the same action so why not seeing them ?

TIA Stuart

http://en.wikipedia.org/wiki/Dark_ambient

Stuart,

Can you include your code for you index method and also the relevant part of the index view.

Cheers

Controller

def index

        @categories = Category.find(:all, :order => "name")         @states = State.find(:all, :order => "name")         @terms = Term.find(:all, :order => "name")         @positions = Position.find(:all, :limit => 0)     end

view:

<% content_for 'formside' do -%> <h1>New search</h1> <% end -%> <div id="parta"> <form id="asearch"> <fieldset><legend>Category</legend> <select name=category_id size="4" multiple = "multiple" id = 'cat'><%= options_from_collection_for_select @categories, :id, :name, :prompt => true %></select></fieldset>

<fieldset><legend>State</legend>

<select name=state_id size="4" multiple = "multiple" id = 'stat'><%= options_from_collection_for_select @states, :id, :name %></select></fieldset>

<fieldset><legend>Terms</legend>

<select name=term_id size="4" multiple = "multiple" id = 'term'><%= options_from_collection_for_select @terms, :id, :name %></select>

Stuart

Hi Stuart,

If you're rendering a partial, you should have a line that looks like "<%= render :partial=>'index' %>. You probably know that, but I didn't see it in the code you included. One mistake that I've found it easy to make is to think that one template is being rendered, when another one is instead.

Cheers Starr

Sorry for the confusion. Acutally by the time I posted the code I had gone back to the regular template. It was in there though when I ran into these problems

Stuart