If you're going to follow Rails convention, go back to author_id. Through AR magic, when you say "book belongs to author," it automagically gives some methods to your book model. One of those is "author" which it expects to return a Author model object found using the author_id attribute as a foreign key. That's why you're getting the mismatch error. I'm assuming when it's author_id, that field is not going to show up in scaffolding b/c rails knows that's a foreign_key and not a regular attribute (like name or title or something).

Going back to the original issue, did you try my suggestion on the form_for syntax? The doc examples show passing both the symbol and instance variable like this:

form_for :book, :@books, :url => { :action => 'create' } do |form|


Chris,

I did try that syntax on the form_for. I still received the same errors that the methods for each of the field names were missing.

The question is, then how can I create a new object and set the foreign key in it in a form?

I've been attempting to use the static scaffold because it automatically generates the "create" "edit" and "new" methods and I'm VERY new at the code. But it seems that I need to build it all from scratch?

Kevin Burk



--
***************************************
BURK DESIGN GROUP
http://www.BurkDesignGroup.com
mailto:[EMAIL PROTECTED]
6161 El Cajon Blvd #306
San Diego, CA 92115
PHONE (619) 583-2311
FAX (619) 583-5801
***************************************
_______________________________________________
Sdruby mailing list
[email protected]
http://lists.sdruby.com/mailman/listinfo/sdruby

Reply via email to