Last active
August 29, 2015 14:11
-
-
Save errakeshpd/5f2c7e247cd3a1370543 to your computer and use it in GitHub Desktop.
how to write this in rails ORM method ?
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT et.id | |
FROM examtypes et | |
LEFT JOIN categoryexams ce ON et.id = ce.examtype_id | |
LEFT JOIN categoryexamusers ceu ON ce.id = ceu.categoryexam_id | |
LEFT JOIN categoryusers cu ON cu.id = ceu.categoryuser_id | |
LEFT JOIN users u ON u.id = cu.user_id | |
WHERE u.id =71 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
examtype
has_many :categoryexams
exam
has_many :categoryexam, :dependent => :destroy
category_exam_user
belongs_to :categoryexam
belongs_to :categoryuser
category_exam
belongs_to :exam
belongs_to :examtype
has_many :categoryexamuser
has_many :categoryusers, :through => :categoryexamuser