Ok, Sorry about the non specific subject title.
Tables are ‘archives’ and ‘extra_files’
Related models:
class Archive < ActiveRecord::Base
belongs_to :category
has_many :extra_file
end
class ExtraFile < ActiveRecord::Base
belongs_to :archive
end
Archive Controller currently looks like this:
class ArchiveController < ApplicationController
scaffold :archive
def list
@header = "Test List"
@subheader = "Everything in the database. Using Adam's layout"
#@programs = Archive.find_all
@program_pages, @programs = paginate :archive
end
def edit
@program = Archive.find(@params["id"])
@categories = Category.find_all
end
end
Now here is the part(s) where I’m at a loss. Below is the edit.rhtml.
I’ve re-edited the text-input fields so many times, I don’t know what I
haven’t done yet…
Originaly the text-input fields were named by hand, and mostly didn’t
render at all without errors.
You probably don’t need the entire edit.rhtml, but I included it all so
you know about where I started from. The relivent part is near the
bottom, near ‘Extra Files’
Thanks
edit.rhtml
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 -%>
Extra Files
<% @program.extra_file.each do |file| -%>
Name: <%= text_field “extra_file”, “name”, “index” => file.id,
“value”=> file.name %>
Location: <%= text_field “extra_file”, “location”, “index” => file.id,
“value”=> file.location %>
<% end -%>
Show |
<%= link_to "Back", :action => "list" %>