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
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:
id program_name file_location etc…
class Archive < ActiveRecord::Base
id archive_id name location
class ExtraFile < ActiveRecord::Base
list.rhtml Relivent section:
<% @programs.each do |program| -%>
<%= link_to file.name, file.location %> <% end -%>
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
<%= @program.description %>
Misc (extended Description)
<%= @program.misc %>
<% ['2000','300','2000 BlueRam'].each do |baud| -%> ><%= baud %> <% end -%>
Yes /> No />
<% @categories.each do |category| -%> ><%= category.name %> <% end -%>
I’m looking to add the list of existing extra files after the Category
I started with this:
<% program.extra_file.each do |file| -%>
… is where I realised I had NO concept how to ensure the data would
stay together properly…
Lance F. Squire