# Collection\_select question

**URL:** <https://www.ruby-forum.com/t/collection-select-question/190087>\
**Category:** Rails\
**Created:** [June 14, 2010, 4:18pm UTC](https://www.ruby-forum.com/t/collection-select-question/190087 "2010-06-14T16:18:17Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![bw2010](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/5f9b8f/32.png) [@bw2010](https://www.ruby-forum.com/u/bw2010)\
**Post date:** [June 14, 2010, 4:18pm UTC](https://www.ruby-forum.com/t/collection-select-question/190087/1 "2010-06-14T16:18:17Z")

</div>

Hello!

New to ruby on rails, so I hope this isn’t a stupid question (great way  
to start a post ;)). Basically I’m trying to avoid making a bunch of  
different columns in my db table by having my collection\_select  
concatenate the ID value it returns to a single text field (for  
instance, the collection\_select will return a footnote ID, and I would  
like to keep it in a job column called footnote) with comma’s in between  
because each job has multiple footnotes.

Is there any way I can accomplish this ? Ideally I would like to put  
comma’s in between so I can break it apart in another area of my  
program.

Thank you for any help.

---

<div class="post-metadata">

**Author:** ![bw2010](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/5f9b8f/32.png) [@bw2010](https://www.ruby-forum.com/u/bw2010)\
**Post date:** [June 14, 2010, 9:31pm UTC](https://www.ruby-forum.com/t/collection-select-question/190087/2 "2010-06-14T21:31:05Z")

</div>

Bee Dubya wrote:

> Hello!
> 
> New to ruby on rails, so I hope this isn’t a stupid question (great way  
> to start a post ;)). Basically I’m trying to avoid making a bunch of  
> different columns in my db table by having my collection\_select  
> concatenate the ID value it returns to a single text field (for  
> instance, the collection\_select will return a footnote ID, and I would  
> like to keep it in a job column called footnote) with comma’s in between  
> because each job has multiple footnotes.

DO NOT DO THAT. You need two tables with a has\_many/belongs\_to  
relationship. You should never ever put multiple values in one field.

> Is there any way I can accomplish this ? Ideally I would like to put  
> comma’s in between so I can break it apart in another area of my  
> program.

Don’t. Read up on proper database normalization, and do it right.

> Thank you for any help.

## Best,

Marnen Laibow-Koser  
[http://www.marnen.org](http://www.marnen.org)  
removed\_email\_address@domain.invalid

---

<div class="post-metadata">

**Author:** ![bw2010](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/5f9b8f/32.png) [@bw2010](https://www.ruby-forum.com/u/bw2010)\
**Post date:** [June 16, 2010, 10:38am UTC](https://www.ruby-forum.com/t/collection-select-question/190087/3 "2010-06-16T10:38:09Z")

</div>

Marnen Laibow-Koser wrote:

> Bee Dubya wrote:
> 
> > Hello!
> > 
> > New to ruby on rails, so I hope this isn’t a stupid question (great way  
> > to start a post ;)). Basically I’m trying to avoid making a bunch of  
> > different columns in my db table by having my collection\_select  
> > concatenate the ID value it returns to a single text field (for  
> > instance, the collection\_select will return a footnote ID, and I would  
> > like to keep it in a job column called footnote) with comma’s in between  
> > because each job has multiple footnotes.
> 
> DO NOT DO THAT. You need two tables with a has\_many/belongs\_to  
> relationship. You should never ever put multiple values in one field.
> 
> > Is there any way I can accomplish this ? Ideally I would like to put  
> > comma’s in between so I can break it apart in another area of my  
> > program.
> 
> Don’t. Read up on proper database normalization, and do it right.
> 
> > Thank you for any help.
> 
> ## Best,
> 
> Marnen Laibow-Koser  
> [http://www.marnen.org](http://www.marnen.org)  
> removed\_email\_address@domain.invalid

In connection with this, and at the risk of reviving a dead thread: a  
big part of database normalisation is atomising your data. This enables  
you to better acclimate your application to future alterations and more  
effective database requests. Searching is a good example of this - I am  
simply reinforcing Marnen’s point regarding database normalisation.
