Skip to content

Instantly share code, notes, and snippets.

@universal
Forked from anonymous/answer.rb
Last active October 25, 2016 09:40
Show Gist options
  • Save universal/79e150a4025d6b2562e7ca94dfb83faa to your computer and use it in GitHub Desktop.
Save universal/79e150a4025d6b2562e7ca94dfb83faa to your computer and use it in GitHub Desktop.
class Answer < ApplicationRecord
belongs_to :question
belongs_to :student
end
class Question < ApplicationRecord
has_many :answers
has_many :students, through: :answers
end
class Student < ApplicationRecord
has_many :answers
has_many :questions, through: :answers
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment