Ruby on Rails Sunday, July 31, 2011

Hi,

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

Started POST "/posts/31/comments" for 127.0.0.1 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.new(params[: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,

Jan

--
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 rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

No comments:

Post a Comment