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

On 10/19/06, Dark A. [email protected] wrote:

getting nil.inject errors.
_index should still be part of the same action so why not seeing them ?

TIA
Stuart

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 -%>

New search

<% end -%>
Category <%= options_from_collection_for_select @categories, :id, :name, :prompt => true %> State

<%=
options_from_collection_for_select @states, :id, :name
%>

Terms

<%=
options_from_collection_for_select @terms, :id, :name %>

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