# Select box not auto populating based on database

**URL:** <https://www.ruby-forum.com/t/select-box-not-auto-populating-based-on-database/111229>\
**Category:** Rails\
**Created:** [August 4, 2007, 1:14am UTC](https://www.ruby-forum.com/t/select-box-not-auto-populating-based-on-database/111229 "2007-08-04T01:14:39Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![eboss](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/e/ea666f/32.png) [@eboss](https://www.ruby-forum.com/u/eboss)\
**Post date:** [August 4, 2007, 1:14am UTC](https://www.ruby-forum.com/t/select-box-not-auto-populating-based-on-database/111229/1 "2007-08-04T01:14:39Z")

</div>

I have an edit form where the form elements are in a partial. Everything  
but one select box is being populated by the database information. There  
are actuall 2 select boxes on the page and the first one populated from  
the database but the second doesn’t.

## Here’s the code that doesn’t populate.

## \<%= select( ‘employee’, ‘priority’, { “1 - Top” =\> “1”, “2” =\> “2”, “3” =\> “3”, “4” =\> “4”, “5” =\> “5”}, :include\_blank =\> true) %\>

## Here is the full form code

\<%= error\_messages\_for ‘employee’ %\>

Active  
FalseTrue

First name  
\<%= text\_field 'employee', 'first\_name' %\>

Last name  
\<%= text\_field 'employee', 'last\_name' %\>

Department  
\<%= select( 'employee', 'department', { "Sales - New" =\> "new", "Sales - Pre-Owned" =\> "preowned", "Sales - Internet" =\> "internet", "Finance" =\> "finance", "Service" =\> "service", "Parts" =\> "parts", "Body Shop" =\> "bodyshop"}, :include\_blank =\> true) %\>

Title  
\<%= text\_field 'employee', 'title' %\>

Main telephone  
\<%= text\_field 'employee', 'main\_telephone' %\>

Direct telephone  
\<%= text\_field 'employee', 'direct\_telephone' %\>

Email  
\<%= text\_field 'employee', 'email' %\>

Sorting Priority  
\<%= select( 'employee', 'priority', { "1 - Top" =\> "1", "2" =\> "2", "3" =\> "3", "4" =\> "4", "5" =\> "5"}, :include\_blank =\> true) %\>

About  
\<%= text\_area 'employee', 'about' %\>

Employee photo  
\<%= file\_column\_field 'employee', 'employee\_photo' %\>

------------------

The “priority” column updates just fine with the select box, it just  
doesn’t populate from the db on load. The only difference between the  
two select boxes on the page is the first is a varchar column while the  
“priority” column is an integer.
