# Populating Select Dropdown for Editing?

**URL:** <https://www.ruby-forum.com/t/populating-select-dropdown-for-editing/168274>\
**Category:** Rails\
**Created:** [May 19, 2009, 2:02am UTC](https://www.ruby-forum.com/t/populating-select-dropdown-for-editing/168274 "2009-05-19T02:02:34Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![casper\_the\_ghost](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/58956e/32.png) [@casper\_the\_ghost](https://www.ruby-forum.com/u/casper_the_ghost)\
**Post date:** [May 19, 2009, 2:02am UTC](https://www.ruby-forum.com/t/populating-select-dropdown-for-editing/168274/1 "2009-05-19T02:02:34Z")

</div>

I’m having trouble populating a select tag in a form?

I have moved the form to a partial so it can be used in both the  
create and edit views. My standard text fields are populated with  
data from the DB just fine in the edit view, but I can’t seem to get  
the select drop downs to work?

How do I force the default value of a select to the value stored in  
the DB? Below is an example of what I have:

Open:\<%= f.select  
(:hours\_sunday\_open, @site.open\_close\_times) %\>

I’ve tried the :selected =\> f.hours\_sunday\_open

It didn’t seem to work.

Thanks
