# Concatenate multiple drop down values into a single string

**URL:** <https://www.ruby-forum.com/t/concatenate-multiple-drop-down-values-into-a-single-string/122588>\
**Category:** Rails\
**Created:** [December 9, 2007, 10:43pm UTC](https://www.ruby-forum.com/t/concatenate-multiple-drop-down-values-into-a-single-string/122588 "2007-12-09T22:43:12Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![kodama](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/439d5e/32.png) [@kodama](https://www.ruby-forum.com/u/kodama)\
**Post date:** [December 9, 2007, 10:43pm UTC](https://www.ruby-forum.com/t/concatenate-multiple-drop-down-values-into-a-single-string/122588/1 "2007-12-09T22:43:12Z")

</div>

Hello Rails board,  
I’ve been poking around the documentation, but I can’t seem to find what  
I’m looking for. Also, all the code below is the standard scaffold stuff  
(besides my helper method).

Basically, my problem is this: I have a string field on my “Event” model  
which is called “start\_time”. I tried using a datetime data type, but I  
don’t like the time select widgets that Rails provides. Basically, the  
widget I need is [hour][min][am|pm].

I tried rolling my own multiselect, and I got it to show up in the UI  
the way I wantedm but the problem I’m having is that only value from the  
first drop-down (i.e. the hour) is getting saved to the database. I  
realize that I’m missing a step here somewhere, so I’m hoping someone  
could point me in the right direction. Thank you!

For reference, here is what I tried to use:

- View (from \_form.rhtml) -

Start time  
\<%= my\_time\_select 'event', 'start\_time' %\>

- My Helper Method -  
module CalendarHelper

end

- The create() method that is getting called -  
@event = Event.new(params[:event])

So…what am I missing? I’m guessing the problem is with my create  
method in the controller. Thanks all!  
-kodama

---

<div class="post-metadata">

**Author:** ![kodama](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/439d5e/32.png) [@kodama](https://www.ruby-forum.com/u/kodama)\
**Post date:** [December 10, 2007, 3:20am UTC](https://www.ruby-forum.com/t/concatenate-multiple-drop-down-values-into-a-single-string/122588/2 "2007-12-10T03:20:30Z")

</div>

Hey guys,  
I need a hand - no-one’s run into this before?

kodama

---

<div class="post-metadata">

**Author:** ![kodama](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/439d5e/32.png) [@kodama](https://www.ruby-forum.com/u/kodama)\
**Post date:** [December 10, 2007, 3:51am UTC](https://www.ruby-forum.com/t/concatenate-multiple-drop-down-values-into-a-single-string/122588/3 "2007-12-10T03:51:44Z")

</div>

Why not just use time\_select?

On Dec 10, 2007 12:50 PM, Old E. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
wrote:

> Hey guys,  
> I need a hand - no-one’s run into this before?
> 
> ## kodama
> 
> Posted via [http://www.ruby-forum.com/](http://www.ruby-forum.com/).
> 
> >

–  
Ryan B.

> **[frozenplague.net](http://www.frozenplague.net)**
>
> This domain may be for sale!

---

<div class="post-metadata">

**Author:** ![kodama](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/439d5e/32.png) [@kodama](https://www.ruby-forum.com/u/kodama)\
**Post date:** [December 10, 2007, 6:25am UTC](https://www.ruby-forum.com/t/concatenate-multiple-drop-down-values-into-a-single-string/122588/4 "2007-12-10T06:25:33Z")

</div>

I checked it out, but I don’t like how the hours go from 0 to 23. Also,  
I need to have the time select show up as [hour][min][am|pm].

Do you know what I’m doing wrong in my widget?

Ryan B. wrote:

> Why not just use time\_select?
> 
> On Dec 10, 2007 12:50 PM, Old E. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
> wrote:
> 
> > Hey guys,  
> > I need a hand - no-one’s run into this before?
> > 
> > ## kodama
> > 
> > Posted via [http://www.ruby-forum.com/](http://www.ruby-forum.com/).
> > 
> > >
> 
> –  
> Ryan B.  
> [http://www.frozenplague.net](http://www.frozenplague.net)
