# Losing arrays with partial

**URL:** <https://www.ruby-forum.com/t/losing-arrays-with-partial/72759>\
**Category:** Rails\
**Created:** [October 18, 2006, 6:03pm UTC](https://www.ruby-forum.com/t/losing-arrays-with-partial/72759 "2006-10-18T18:03:37Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![zanoni](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/z/e99b99/32.png) [@zanoni](https://www.ruby-forum.com/u/zanoni)\
**Post date:** [October 18, 2006, 6:03pm UTC](https://www.ruby-forum.com/t/losing-arrays-with-partial/72759/1 "2006-10-18T18:03:37Z")

</div>

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

–

> **[Dark ambient](https://en.wikipedia.org/wiki/Dark_ambient)**
>
> Dark ambient (referred to as ambient industrial especially in the 1980s) is a genre of post-industrial music that features an ominous, dark droning and often gloomy, monumental or catacombal atmosphere, partially with discordant overtones. It shows similarities with ambient music, a genre that has been cited as a main influence by many dark ambient artists, both conceptually and compositionally. Although mostly electronically generated, dark ambient also includes the sampling of hand-pla 
> The te...

---

<div class="post-metadata">

**Author:** ![zanoni](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/z/e99b99/32.png) [@zanoni](https://www.ruby-forum.com/u/zanoni)\
**Post date:** [October 18, 2006, 6:07pm UTC](https://www.ruby-forum.com/t/losing-arrays-with-partial/72759/2 "2006-10-18T18:07:39Z")

</div>

On 10/19/06, Dark A. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) 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

---

<div class="post-metadata">

**Author:** ![zanoni](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/z/e99b99/32.png) [@zanoni](https://www.ruby-forum.com/u/zanoni)\
**Post date:** [October 18, 2006, 6:31pm UTC](https://www.ruby-forum.com/t/losing-arrays-with-partial/72759/3 "2006-10-18T18:31:44Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![zanoni](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/z/e99b99/32.png) [@zanoni](https://www.ruby-forum.com/u/zanoni)\
**Post date:** [October 18, 2006, 7:21pm UTC](https://www.ruby-forum.com/t/losing-arrays-with-partial/72759/4 "2006-10-18T19:21:56Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![zanoni](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/z/e99b99/32.png) [@zanoni](https://www.ruby-forum.com/u/zanoni)\
**Post date:** [October 18, 2006, 9:02pm UTC](https://www.ruby-forum.com/t/losing-arrays-with-partial/72759/5 "2006-10-18T21:02:53Z")

</div>

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
