I'm trying to implement a nested set that belongs to another model using the Ancestry gem.

Using the old Posts/Comments example, I'm trying to do something like this:

Post
has_many comments

Comment
belongs_to post
has_ancestry

So if I have a Comment which belongs to a Post with ID of 1, I want any children of that Comment to inherit the Post ID.

Is there a nice Rails-Way to do this?

有帮助吗?

解决方案

I think you should watch this

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top