<%= select('user', 'sites', Site.find_all.collect {|site| site.name}) %>
<%= collection_select :user, :sites, Site.find(:all), :id, :name %>
This will generate a key-value pair of site.name and site.id in the select tag.
11397 users tagging and storing useful source code snippets
Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world
<%= select('user', 'sites', Site.find_all.collect {|site| site.name}) %>
<%= collection_select :user, :sites, Site.find(:all), :id, :name %>
You need to create an account or log in to post comments to this site.
(The important part being the &:name, the others are just oddities of my style.)