Skip to content

Instantly share code, notes, and snippets.

@meagar
Created October 4, 2016 13:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save meagar/af327fbca81dcabaeee2320d2b5f680a to your computer and use it in GitHub Desktop.
Save meagar/af327fbca81dcabaeee2320d2b5f680a to your computer and use it in GitHub Desktop.
# This is pure data, it's the definition of a category
class Category
has_many :clues
# name: string
end
# This is pure data, it's the definition of a category, it's not tied to any user or game
class Clue
belongs_to :category
# answer: string
# question: string
end
# This ties a specific user to a set of clues through GameClue
class Game
belongs_to :user
has_many :game_clues
end
# This ties together a Game, a Clue and the user's inputted answer
class GameClue
belongs_to :game
belongs_to :clue
belongs_to :inputted_user_answer # Nil until a user inputs an answer
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment