Skip to content

Instantly share code, notes, and snippets.

@vidmantas
Created February 20, 2010 06:59
Show Gist options
  • Save vidmantas/309556 to your computer and use it in GitHub Desktop.
Save vidmantas/309556 to your computer and use it in GitHub Desktop.
<% cat_opts = [] %>
<% Category.all.each do |c| %>
<% cat_opts << [c.name, c.id] %>
<% end %>
<%= f.select :category_id, cat_opts %>
<%= f.select :category_id, Category.all.map{ |c| [c.name, c.id] } %>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment