Rails 3 ancestry model belongs_to another model
-
03-06-2021 - |
Domanda
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?
Soluzione
I think you should watch this
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow