# Collection\_select - prepending a "any" option

**URL:** <https://www.ruby-forum.com/t/collection-select-prepending-a-any-option/103032>\
**Category:** Rails\
**Created:** [April 30, 2007, 11:43pm UTC](https://www.ruby-forum.com/t/collection-select-prepending-a-any-option/103032 "2007-04-30T23:43:58Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![sbeam](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/258eb7/32.png) [@sbeam](https://www.ruby-forum.com/u/sbeam)\
**Post date:** [April 30, 2007, 11:43pm UTC](https://www.ruby-forum.com/t/collection-select-prepending-a-any-option/103032/1 "2007-04-30T23:43:58Z")

</div>

Say I have a normal tag being generated thusly:

```
<%= collection_select :task, :id, Task.find(:all), :id, :name %>

```

what is the easiest way to add a “ANY” option to the top of the option  
list? I know Task.find(:all) returns a collection object, so is there  
a unshift() for that?

well OK I tried:

```
 Task.find(:all).unshift([:id=>0, :name=>'ANY'])

```

but that is just a vanilla Array with “undefined method `name’”…?

thanks  
Sam

---

<div class="post-metadata">

**Author:** ![sbeam](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/258eb7/32.png) [@sbeam](https://www.ruby-forum.com/u/sbeam)\
**Post date:** [May 1, 2007, 12:46am UTC](https://www.ruby-forum.com/t/collection-select-prepending-a-any-option/103032/2 "2007-05-01T00:46:04Z")

</div>

Found the answer in the source for actionpack-1.13.2/lib/action\_view/  
helpers/form\_options\_helper.rb

the :prompt option can take a value that goes atop -\>

\<%= collection\_select :task, :id, Task.find(:all), :id, “type\_name”,  
{ :prompt =\> ‘— any —’ } %\>
