15 minute RoR blog help

Mariko, note that your error message says:

"Couldn't find Post without an ID"

Which means that ActiveRecord has been asked to go find a Post, but no id was supplied. When you create a default model in a migration with Rails like:

create_table :posts do |t|   t.column :some_column, :string end

you will also get - automatically - a column called "id". Just plain "id". Of course you also get your Post model and a bunch of other stuff for free. In you Comment model (comments table) the column called "post_id" is how Rails goes and finds the relevant Post object in their belongs_to relationship.

So a few things to look at: (a) Suggest you use the form_for version of forms tags when using a model, rather than form_tag, it does more for you. (b) Your view is refering to @post, but i see nothing that sets than instance variable in your controller (c) So I suspect the error you're getting, assuning its when you "submit" is that your find() is failing because no "id" is set. But again, not the error is referring to the "id" column on the Post object - not the "post_id" column on the Comment object.

A bit hard to tell from the elements of code you submitted. Happy to take a quick look if you email the model, controller and view to me at kipcole9 -at- gmail dot you-know-what.

Cheers, --Kip