I'm having some trouble with my realtions (I think). I'm creating a
guestbook with comments in ajax (the structure resembles the structure
of a blog). So I've got a "flogs table" which keeps the "user_id" and
the "id" of the flogs. This table. Then I've got a "guestbooks table"
containing "id" of the guestbooks, "flog_id", "title", "body",
"created_at" and "updated_at". This one does NOT get created, resulting
in (for example) "nil.title". (guestbook.title)
Then I've got a "notes table" containing "id" of the notes, "user_id",
"guestbook_id", "body" and "created_at".
The realtions may be wrong here (at least that is what I suspect
although I can't see why they wouldn't).
You've shown us the relations (which appear at least vaguely sane (although I'm not entirely sure of the point of the flogs tables)) but not any of the code that is producing the error.
Then I've got a "notes table" containing "id" of the notes, "user_id",
"guestbook_id", "body" and "created_at".
The realtions may be wrong here (at least that is what I suspect
although I can't see why they wouldn't).
You've shown us the relations (which appear at least vaguely sane
(although I'm not entirely sure of the point of the flogs tables)) but
not any of the code that is producing the error.
Fred
Okay, well, thanks Fred for checking it.
Scratched the flog-table and placed the user_id in the guestbook table
instead.
If my relations are right, the fault may be in my Ajax code (and I'm
very newbee to Ajax) so maybe this is what's wrong.
The main problem being "undefined local variable or method `guestbook'
for #<#<Class:0xaada638>:0xaada610>"
when it gets the partial _post: "app/views/guestbook/_post.rhtml"
in this case you get a single ActiveRecord object instead of the list of
search results you would get with for example @guestbook =
Guestbook.find(:all,...)
in this case you get a single ActiveRecord object instead of the
list of
search results you would get with for example @guestbook =
Guestbook.find(:all,...)