# Hard coded drop down menu help

**URL:** <https://www.ruby-forum.com/t/hard-coded-drop-down-menu-help/162016>\
**Category:** Rails\
**Created:** [March 4, 2009, 10:57pm UTC](https://www.ruby-forum.com/t/hard-coded-drop-down-menu-help/162016 "2009-03-04T22:57:23Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![jimmypalmer](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/bbe5ce/32.png) [@jimmypalmer](https://www.ruby-forum.com/u/jimmypalmer)\
**Post date:** [March 4, 2009, 10:57pm UTC](https://www.ruby-forum.com/t/hard-coded-drop-down-menu-help/162016/1 "2009-03-04T22:57:23Z")

</div>

I currently have a drop down menu selection in an input form with  
hardcoded values, the problem I’m having is I want to use multiple word  
entries that users can select from, is there anyway of doing that?

here is my code as it exists now

\<%= f.label :category, “Category” %\>  
  
\<%= select ‘article’, ‘category’, %w(Cooperation  
EnvironmentalSustainability BusinessDevelopment Transportation  
Streetscape DenseMixedUse) %\>

obviously I need some of these to be two words as one entry instead of  
being multiple entries

please help!

---

<div class="post-metadata">

**Author:** ![jimmypalmer](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/bbe5ce/32.png) [@jimmypalmer](https://www.ruby-forum.com/u/jimmypalmer)\
**Post date:** [March 4, 2009, 11:20pm UTC](https://www.ruby-forum.com/t/hard-coded-drop-down-menu-help/162016/2 "2009-03-04T23:20:38Z")

</div>

On Mar 4, 2009, at 4:57 PM, Jimmy P. wrote:

> Streetscape DenseMixedUse) %\>
> 
> obviously I need some of these to be two words as one entry instead of  
> being multiple entries
> 
> please help!

Just skip the shorthand:

[‘Cooperation’, ‘Environmental Sustainability’, ‘Business Development’,  
‘Transportation’, ‘Streetscape’, ‘Dense Mixed Use’ ]

Even better might be a model to return the choices.

class Category  
def self.choices\_for\_select  
[‘Cooperation’, ‘Environmental Sustainability’, ‘Business  
Development’,  
‘Transportation’, ‘Streetscape’, ‘Dense Mixed Use’ ]  
end  
end

\<%= select ‘article’, ‘category’, Category.choices\_for\_select %\>

-Rob

Rob B. [http://agileconsultingllc.com](http://agileconsultingllc.com)  
removed\_email\_address@domain.invalid

---

<div class="post-metadata">

**Author:** ![jimmypalmer](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/bbe5ce/32.png) [@jimmypalmer](https://www.ruby-forum.com/u/jimmypalmer)\
**Post date:** [March 4, 2009, 11:36pm UTC](https://www.ruby-forum.com/t/hard-coded-drop-down-menu-help/162016/3 "2009-03-04T23:36:53Z")

</div>

Rob B. wrote:

> Just skip the shorthand:

It should also work by escaping the spaces:  
%w{Cooperation  
Environmental\ Sustainability Business\ Development Transportation  
Streetscape Dense\ Mixed\ Use}

Note: noticed the curly braces %w{list of words}

---

<div class="post-metadata">

**Author:** ![jimmypalmer](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/bbe5ce/32.png) [@jimmypalmer](https://www.ruby-forum.com/u/jimmypalmer)\
**Post date:** [March 5, 2009, 1:14am UTC](https://www.ruby-forum.com/t/hard-coded-drop-down-menu-help/162016/4 "2009-03-05T01:14:15Z")

</div>

thanks guys, that was perfect
