Ruby on Rails - Drop down menu

A noob here. I've only just started to learn ROR, and I'm having a problem with a drop down menu, that allows the user to select a project from a database. I have the drop down menu working, however instead of the project names, it shows something like Project:0xb61fbdbc.

    <%= f.label :project_name %><br />
    <%= f.select(:project_name, Project.all, :prompt => "Select a Project") %>

I have searched,and searched and had no luck. Hopefully someone can help.

Thanks in advance.

Answers


This should help, provided that you have a name attribute in your Project model:

<%= f.select(:project_name, Project.all.map {|p| [p.name,p.id]}, :prompt => "Select a Project") %>

Need Your Help

XClass in TYPO3 6.2

php typo3 typoscript

Now I am using TYPO3 6.2beta5 version and in that website I need to include an XClass for the extension sr_feuser_register. Its a "PI_Base" extension and I tried the following methods to include XC...

How to create reusable components in Spring MVC 3.0

java spring jsp spring-mvc tiles

Ok I really don't know where to start. I have been trying to develop reusable component-like pages in Spring MVC. I ended up using tiles. I had the idea from "Spring in action" book on writing