# Noob simple question create custom options\_for\_select

**URL:** <https://www.ruby-forum.com/t/noob-simple-question-create-custom-options-for-select/175676>\
**Category:** Rails\
**Created:** [September 17, 2009, 3:06pm UTC](https://www.ruby-forum.com/t/noob-simple-question-create-custom-options-for-select/175676 "2009-09-17T15:06:49Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Marcos\_MSSS\_ller](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/96bed5/32.png) [@Marcos\_MSSS\_ller](https://www.ruby-forum.com/u/Marcos_MSSS_ller)\
**Post date:** [September 17, 2009, 3:06pm UTC](https://www.ruby-forum.com/t/noob-simple-question-create-custom-options-for-select/175676/1 "2009-09-17T15:06:49Z")

</div>

Hello everyone,

I’m starting learning ruby on rails and i have a question that maybe is  
more  
about ruby but anyway.

I have a table with 2 columns type and value and i would like to create  
a  
select that had like options all the values but for certain types they  
should appear as the text.  
I want to achieve something like:

Select the option:

private public Group tkk Group Rails Group The great school User testi1 User testi2 User testi3

In my example i would like that all the lines that is related to users  
or  
groups has the type in the select text.

Can i use select or should be select\_tag and also how can i create this  
default options if they come from the database and i have to do some  
“coding” before put into the select?

Any tips will be appreciated.

Thank you!

–  
Marcos MÃ¼ller Lopes Fonseca  
Arquiteto da InformaÃ§Ã£o - MAV Tecnologia  
Gerente de projetos - UFMG InformÃ¡tica Jr.  
Sistemas de InformaÃ§Ã£o - UFMG  
removed\_email\_address@domain.invalid / 87553132

---

<div class="post-metadata">

**Author:** ![Marcos\_MSSS\_ller](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/96bed5/32.png) [@Marcos\_MSSS\_ller](https://www.ruby-forum.com/u/Marcos_MSSS_ller)\
**Post date:** [September 18, 2009, 4:42pm UTC](https://www.ruby-forum.com/t/noob-simple-question-create-custom-options-for-select/175676/2 "2009-09-18T16:42:56Z")

</div>

On Sep 17, 9:04 am, Marcos Müller [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> Hello everyone,
> 
> I’m starting learning ruby on rails and i have a question that maybe is more  
> about ruby but anyway.
> 
> I have a table with 2 columns type and value and i would like to create a  
> select that had like options all the values but for certain types they  
> should appear as the text.

Before you go any further I suggest that you read  
[Entity–attribute–value model - Wikipedia](http://en.wikipedia.org/wiki/Entity-attribute-value_model),  
particularly the caveats listed at the bottom of the article. Except  
in extraordinary circumstances adopting an eav model defeats the  
purpose of a relational database system from the outset.
