Ruby on Rails Sunday, July 31, 2011

Am 31.07.11 22:02, schrieb Hassan Schroeder:
> On Sun, Jul 31, 2011 at 12:29 PM, Jan Marquardt<> wrote:
>> 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?
> 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,


You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post to this group, send email to
To unsubscribe from this group, send email to
For more options, visit this group at

No comments:

Post a Comment