There are two basic cases where I want to use FormHelper (form_for) to
create select tags:
Where the options come from another table
Where the options come from a manually created list or hash
An example of 1 might be a tagging application. I may have a photo
sharing site that lets users select a tag from a list box (select) and
the tags come from a table.
An example of 2 might be a new/edit user form where gender is male or
female and male is stored as 1 and female is stored in 2.
I cannot find a simple example of these 2 cases. So,
a) can someone post a simple example of both
b) where does a new rails developer find docs for this stuff?
the idea is to select a group for invitations to be shown
together with an “all” entry
the basic thing is to hand over an array with the key/value pairs
you can use a simple array as the all entry [[“all”, 0], [“more”, 1]]
or collect an db-record into such an array
and as here, combine several arrays as long as the ids don’t conflict
selected is always zero here, you could give it any key
onchange triggers the form submit, you could use a ‘normal’ submit
instead