Collection_select with an index

Hi,

I’m new to Rails, this is my first try, so be gentle, I tried to google
but could solve my problem. :slight_smile:

I’m trying to use the index-option of, for example, the text_field in a
collection_select. I found out that collection_select expects the index
in the html_options instead of the options as in text_field. I found a
similar problem
http://groups.google.com/group/rubyonrails-talk/browse_thread/thread/b3ccd87b74c6ab9b/bf6d5440d0ffefe8,
but it had no effect on my output. ATM I’m using:

line_f.collection_select :char_id, @chars, :id, :firstname, :prompt =>
“Choose character”, “index” => 1

But the html output remains as follows:

<option […]

I expected something like ‘id=“line_1_char_id” name=“line[1][char_id]”’.
Any idea what I’m doing wrong?

TIA, Jakob

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs