Posted By

justincrounds on 09/25/10


Tagged


Versions (?)

questy


 / Published in: Rails
 

  1. class Playerquest < ActiveRecord::Base
  2. belongs_to :player
  3. belongs_to :quest
  4.  
  5. after_create :get_children
  6.  
  7. def get_children
  8. children = Quest.find_all_by_parent(self.quest_id)
  9. children.each do |child|
  10. Playerquest.create(:player_id => self.player_id, :quest_id => child.id)
  11. end
  12. end
  13.  
  14. end

Report this snippet  

You need to login to post a comment.