Topic: inserting a different table text box into a form view?
So I'm slowly moving forward on this Rails app I'm building and I've realized that I need have a form view include an editable text box from a separate table. Originally, I had my app working so that there was a single table (called "story) in this view that contained a title, an author, and a description. Now, I've realized that I want the author to be a separate table so I can have a single author assigned to multiple stories.
Now I know I can create a controller to add authors, and eventually I will, but currently I want all the creation & editing of author name to happen within the story form view. In other words, I want these three fields:
Title (story.title)
Author (author.name)
Description (story.description)
to all be editable in the same view (either edit or create) using the same "save" button etc...
This is what the code for the title & description looks like:
<p><label for="story_title">Title</label><br/>
<%= text_field 'story', 'title' %></p><p><label for="story_description">Description</label><br/>
<%= text_area 'story', 'description' %></p>
and within my models, story belongs_to :author and author has_many :stories
How do I hook up that text area for author.name to work right?
Last edited by dsinker (2006-11-05 16:48:47)