how can I do self-reference with ruby on rails?

后端 未结 4 720
没有蜡笔的小新
没有蜡笔的小新 2021-01-01 12:34

I want to self-referentiate a model in a RoR app but, I don\'t know exactly how. I want to save a linked list where the next node has the id of the previous one. how can I d

4条回答
  •  自闭症患者
    2021-01-01 13:02

    Also check out this tutorial by Ryan Bates on self referential association here. Hck's answer will work but for me, I need a JOIN table and so I use a has_many through association of Rails. Good luck!

提交回复
热议问题