Guest User

Untitled

a guest
Jun 24th, 2018
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.68 KB | None | 0 0
  1. # users are dynamic
  2.  
  3. Class User
  4. has_many :games
  5. has_many :items, :through => :games
  6. has_many :objectives, :through => :games
  7. has_one :backpack, :through => :games
  8. end
  9.  
  10.  
  11.  
  12. # Game Model serves as a go-between for users (dynamic) and gameplay (static)
  13.  
  14. Class Game
  15. belongs_to :user
  16. belongs_to :item
  17. belongs_to :objective
  18. belongs_to :backpack
  19. end
  20.  
  21.  
  22.  
  23.  
  24.  
  25. # everything below this comment is a static game variable, essentially
  26.  
  27. Class Item
  28. has_many :games
  29. has_many :users :through => :games
  30. end
  31.  
  32. Class Objectives
  33. has_many :games
  34. has_many :users, :through => :games
  35. end
  36.  
  37. Class Backpack
  38. has_many :games
  39. has_many :users, :through => :games
  40. end
Add Comment
Please, Sign In to add comment