What does your model look like? Do you have the appropriate has_many and 
belongs_to for the "subcomments" to work?

In general, you shouldn't need to specify comment_id for the child when you 
access it via the has_many relationship.

For example:

@comment = Comment.find(params[:id])
new_comment = @comment.subcomments.create

Rails knows that new_comment is a child of @comment since you accessed it 
via subcomments.

Another example:

@comment = Comment.find(params[:id])
new_comment = Comment.create(:comment_id=>@comment.id)

This is basically the same as above, except instead of creatin through 
subcomments, you can specify the parent comment_id.

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

Reply via email to