Formatting form tags for children of parrent data?

This my first Rails project.

All my previous work was done it Perl, so I may be missing the
Ruby/Rails obvious here.

The site I’m working on needs to display archived programs.
Some of the programs have multiple versions, all belonging to the same
listing.
As such, I’ve set-up an extra_files table related to the archive list.

Displaying the extra files was trivial. However, when I went to edit the
edit.rhtml file, I had no idea how to format the text input fields so
that they would be automaticly picked-up and placed with the parrent.

Here’s what I have:

archives table:
id program_name file_location etc…

archives model:
class Archive < ActiveRecord::Base
belongs_to :category
has_many :extra_file
end

extra_files table:
id archive_id name location

extra_files model:
class ExtraFile < ActiveRecord::Base
belongs_to :archive
end

list.rhtml Relivent section:
<% @programs.each do |program| -%>

<%= link_to program.program_name, program.file_location %> <% program.extra_file.each do |file| -%>
<%= link_to file.name, file.location %> <% end -%> <%= program.author %> <%= program.reference %> <%= program.format %> <%= program.description %>

Now How to display the extra_files name and location in the edit.rhtml,
so they can be edited, and returned to the proper place in the database
is where I’m stuck…

I’m presuming the extra_file id would need to be associated with the
name and location fields somehow…

Here’s my edit.rhtml as it currently stands:

Edit Program Listing

Edit Program Listing

Title

Author

Format

Reference

Release Date

Description
<%= @program.description %>

Misc (extended Description)
<%= @program.misc %>

Baud
<% ['2000','300','2000 BlueRam'].each do |baud| -%> ><%= baud %> <% end -%>

Archival Status

File Location

Extra Ram
Yes /> No />

Category:
<% @categories.each do |category| -%> ><%= category.name %> <% end -%>

Show | <%= link_to "Back", :action => "list" %>

I’m looking to add the list of existing extra files after the Category
drop-down.

I started with this:

Extra Files

<% program.extra_file.each do |file| -%>
<input id="…

… is where I realised I had NO concept how to ensure the data would
stay together properly…

Lance F. Squire

After much hacking I’ve got this:

Extra Files

<% @program.extra_file.each do |file| -%>
Name:
Location:

<% end -%>

Which looks promissing in the paramiters view on the error page, but
still dosen’t work…

“extra_file[2]”=>{“name”=>“test Extra files2+”, “location”=>"#"},
“extra_file[1]”=>{“name”=>“test Extra files1+”, “location”=>"#"},