Rails 3 ancestry model belongs_to another model
-
03-06-2021 - |
سؤال
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
لا تنتمي إلى StackOverflow