# Option for select

**URL:** <https://www.ruby-forum.com/t/option-for-select/69218>\
**Category:** Rails\
**Created:** [September 19, 2006, 1:44pm UTC](https://www.ruby-forum.com/t/option-for-select/69218 "2006-09-19T13:44:40Z")\
**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:** [September 19, 2006, 1:44pm UTC](https://www.ruby-forum.com/t/option-for-select/69218/1 "2006-09-19T13:44:40Z")

</div>

One thing I haven’t figured out or found an answer to is if I create a  
select tag from a database table, how can I have an option for “Please  
select” or “choose” or whatever -  
I know i can do something like :include\_blank =\> true. That works  
fine. I came across an option like :include\_blank\_text =\> ‘something’,  
but that didn’t work.

Anyone know how to do it ?

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:** [September 19, 2006, 4:15pm UTC](https://www.ruby-forum.com/t/option-for-select/69218/2 "2006-09-19T16:15:04Z")

</div>

On 9/19/06, Dark A. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> One thing I haven’t figured out or found an answer to is if I create a  
> select tag from a database table, how can I have an option for “Please  
> select” or “choose” or whatever -  
> I know i can do something like :include\_blank =\> true. That works  
> fine. I came across an option like :include\_blank\_text =\> ‘something’,  
> but that didn’t work.
> 
> Anyone know how to do it ?

Add that option manually.

@options = [[‘Select from list’, ‘’]] + Product.find(:all,  
…).map{|p| p.name, p.id}

options\_for\_select(@options, …)

–  
Rule Of Robustness: Robustness is the child of transparency and  
simplicity.

---

<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:** [September 19, 2006, 5:36pm UTC](https://www.ruby-forum.com/t/option-for-select/69218/3 "2006-09-19T17:36:20Z")

</div>

I can’t seem to make this work -

This is what I have currently -  
State  
  
\<% @states = State.find(:all, :order =\> “name”).map {|s| [s.name, s.id]}  
%\>  
\<%= f.select(“state” , @states, “include\_text” =\> ‘please’ ) %\>

Adding in the options seems to throw some parsing errors.

Stuart

On 9/19/06, Michael C. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> > Anyone know how to do it ?  
> > simplicity.
> 
> >

–

> **[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:** [September 19, 2006, 5:58pm UTC](https://www.ruby-forum.com/t/option-for-select/69218/4 "2006-09-19T17:58:25Z")

</div>

\<% @states = [[‘Please’, ‘’]] + State.find(:all, :order =\> “name”).map  
{|s| [s.name, s.id]} %\>  
\<%= f.select(“state” , @states ) %\>

---

<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:** [September 19, 2006, 5:56pm UTC](https://www.ruby-forum.com/t/option-for-select/69218/5 "2006-09-19T17:56:24Z")

</div>

Okay, working now as;  
State  
  
\<% @states = State.find(:all, :order =\> “name”).map {|s| [s.name, s.id]} %\>  
\<%= f.select(“state” , [[‘Please Select’, ‘’]] + @states ) %\>

Does anyone know what the ‘prompt’ option is in a select ? I came  
across mention of this in this patch message -  
[http://dev.rubyonrails.org/ticket/3858](http://dev.rubyonrails.org/ticket/3858)  
Haven’t found anything on it though.

Stuart

On 9/19/06, Dark A. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> > > but that didn’t work.  
> > > –  
> > > Rule Of Robustness: Robustness is the child of transparency and  
> > > simplicity.
> > 
> > > >
> 
> –  
> [Dark ambient - Wikipedia](http://en.wikipedia.org/wiki/Dark_ambient)

–

> **[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...
