Skip to content

Instantly share code, notes, and snippets.

Created October 25, 2016 09:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save anonymous/b2ccb4375625296fdc9fd61c79668f39 to your computer and use it in GitHub Desktop.
Save anonymous/b2ccb4375625296fdc9fd61c79668f39 to your computer and use it in GitHub Desktop.
class Answer < ApplicationRecord
has_one :reply, dependent: :destroy
has_one :student, through: :replies
end
class Reply < ApplicationRecord
belongs_to :reply
belongs_to :student
end
class Student < ApplicationRecord
has_many :replies, dependent: :destroy
has_many :answers, through: :replies
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment