combobox from array

Hi, I'm new in ruby and i need do the next:

I want get a combobox from an array (@array) and save that value in a
table called "form", into a field called "combo", i want save the
value, not an id
someone could tell me what i have to write?
Thanks

To get what you want you need two parts...

First you need an array of the objects in question and then you need a
field on a form that uses that array.

To create the array you could do something like:

def create_chapter_list
    chapters = Chapter.find(:all)
    chapter_list = Array.new
    chapters.each do |chapter|
      #Chapter ID must be place in the array as an integer - that is
how it is stored in the DB
      chapter_list << [chapter.school_and_name, chapter.id]
    end
    return chapter_list.sort!
  end

Note that the array has two values per element so its an array in an
array. What you put in the first slot is what you would see in the
list and the second is what you would have submitted in a form.

Then in the form you would reference that array:

<%= f.select :chapter_id, @chapter_list, :prompt => 'Select a
Chapter' %>

In this example I am using a select object but the idea is the same
for all the list selection types in a form. There are details on the
form options in the RoR documentation ... for example:

http://api.rubyonrails.org/classes/ActionView/Helpers/FormOptionsHelper.html#M002302