search for: forked_stories

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

2009 Sep 01
5
Deep nested associations on the same Model
...us! I''m working on a creative collaboration app whereby one user could 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...