Skip to content

Instantly share code, notes, and snippets.

@crova
Last active June 15, 2016 19:43
Show Gist options
  • Select an option

  • Save crova/481e4c662959d31ee34f5b4a79fc9252 to your computer and use it in GitHub Desktop.

Select an option

Save crova/481e4c662959d31ee34f5b4a79fc9252 to your computer and use it in GitHub Desktop.
How to populate select list with data from a specific model?
<tr>
<th><%= f.label(:deal) %></th>
<td><%= f.select(:deal, options_for_select([['CPL', 'CPL'], ['CPC', 'CPC'], ['CPM', 'CPM'], ['CTL', 'CTL'], ['CPA', 'CPA']]), :value => @single_shoot.deal) %></td>
</tr>
create_table "deals", force: :cascade do |t|
t.string "deal"
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment