Tim Shaffer wrote in post #993815:
> 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.
>
>
> @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.

In comment.rb I have has_many :subcomments
In subcomment.rb I have belongs_to comment

Is that correct.

Both of your examples throw up 'Couldn't find Comment without an ID'

Am I missing smething vital

-- 
Posted via http://www.ruby-forum.com/.

-- 
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