# Drop Down Menu Problem

**URL:** <https://www.ruby-forum.com/t/drop-down-menu-problem/164483>\
**Category:** Rails\
**Created:** [April 1, 2009, 8:47pm UTC](https://www.ruby-forum.com/t/drop-down-menu-problem/164483 "2009-04-01T20:47:14Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![rikki123s](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/df788c/32.png) [@rikki123s](https://www.ruby-forum.com/u/rikki123s)\
**Post date:** [April 1, 2009, 8:47pm UTC](https://www.ruby-forum.com/t/drop-down-menu-problem/164483/1 "2009-04-01T20:47:14Z")

</div>

Here is my papers table:

title:string  
duration:integer  
exam\_at:datetime  
paper\_id:integer  
author:string

and here is my author table:

name:string  
email:string  
telephone:string  
author\_id:string

I have created views for both of these table, and I have implemented the  
CRUD structure for them both, but there is one small problem I have.  
when it comes to creating a new paper, and generating the value for the  
author value in the papers table, I want to use a select drop down menu  
that consists of the names of all the authors in the authors table (so i  
can select which author created the paper).

right now I have the html code displayed like this:

\<% form\_for(@paper) do |f| %\>  
\<%= f.error\_messages %\>

\<%= f.label :title %\>  
  
\<%= f.text\_field :title %\>

\<%= f.label :duration %\> (Minutes)  
  
\<%= f.text\_field :duration %\>

\<%= f.label :exam\_at %\>  
  
\<%= f.datetime\_select :exam\_at %\>

\<%= f.label :paper\_id %\> ID  
  
\<%= f.text\_field :paper\_id %\>

\<%= f.label :author %\>

#AREA OF CODE TO BE FOCUSED ON

\<select name=“select”, :author\>  
Select Author…  
\<% for author in @authors %\>  
\<%=h author.name %\>  
\<% end %\>

#AREA OF CODE TO BE FOCUSED ON

\<%= f.submit “Create” %\>  
\<% end %\>

Obviously this code will produce a drop down menu that shows the names  
of all the authors, but will not save to the table, because it is not  
being held by ‘f’. I was just wondering if anybody new the code for this  
(should start with “\<%= f.select” I believe.

Hope someone can help

---

<div class="post-metadata">

**Author:** ![rikki123s](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/df788c/32.png) [@rikki123s](https://www.ruby-forum.com/u/rikki123s)\
**Post date:** [April 3, 2009, 3:36am UTC](https://www.ruby-forum.com/t/drop-down-menu-problem/164483/2 "2009-04-03T03:36:33Z")

</div>

I found out.

\<%= f.collection\_select( :author, @authors, :name, :name, {}, {} ) %\>

Just for anyone who may have the same problem at some point
