Skip to content

Instantly share code, notes, and snippets.

@abhishekbose87
Last active August 29, 2015 14:13
Show Gist options
  • Select an option

  • Save abhishekbose87/ca48ddf8b2360414c50a to your computer and use it in GitHub Desktop.

Select an option

Save abhishekbose87/ca48ddf8b2360414c50a to your computer and use it in GitHub Desktop.
Model design for Survey application
Survey
polymorphic :type ["Employee", "Event"]
string :desc
has_many :questions
Question
string: desc
has_one :correct_choice
belongs_to :survey
has_many :choices
Choice
string: desc
belongs_to :question
has_many :users through :feedback
Feedback
belongs_to :choice
belongs_to :user
User
string :username
string :email
password
has_many :choices through :feedback
@gautamrege
Copy link

👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment