سؤال

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