search for: parent_story_id

Displaying 1 result from an estimated 1 matches for "parent_story_id".

2009 Sep 01
5
Deep nested associations on the same Model
...submit a Story and this can then be forked by another user and worked on seperately. To acheive this I have a has_many association within the same Story model as such: class Story < ActiveRecord::Base has_many :forked_stories, :class_name => ''Story'', :foreign_key => :parent_story_id belongs_to :parent_story end In this way if a single story is an original it''s parent_story_id will be nil. Similarly, if I call @story.forked_stories I can get a collection of all the stories that have been forked from the current one, or @story.parent_story will return the story fro...