Problem by creating object


I am totally stuck with a problem creating an object. This is the request:

Started POST "/posts/31/comments" for at 2011-07-31 21:11:01 +0200    Processing by CommentsController#create as HTML    Parameters: {"utf8"=>"✓", "authenticity_token"=>"cU60iQ+GXqB8fVREw8mOMgkmvaLIQZa+6puTFqxmV5s=", "comment"=>{"email"=>"", "website"=>"", "comment"=>""}, "commit"=>"Create Comment", "post_id"=>"31"}

So I think I would get the object with the following code within the create action of the CommentsController.

def create    @comment =[:comment]) end

But an inspect on @comment shows me that the object is empty:

#<Comment id: nil, comment: "", email: "", website: "", post_id: nil, created_at: nil, updated_at: nil>

May anyone give me a hint what i am doing wrong?

I appreciate your help. Thanks.

Kind regards,


What are you expecting? Your request has a punch of empty comment parameters; the only actual value is "post_id" which you're ignoring.

If "post_id" is an attribute of comment, why isn't it part of the comments parameters?

Thanks Hassan, this was the epiphany i needed. I didn't realized that post_id isn't within the comment hash.

Sorry for bothering you with this stupid question.

Kind regards,