Created
May 15, 2014 21:54
-
-
Save rojotek/6c82cc0fd9bf38b475c8 to your computer and use it in GitHub Desktop.
has_many through
This file contains hidden or 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
class Project | |
has_many :project_departments | |
has_many :departments, through: :project_departments | |
end | |
class ProjectDepartment | |
belongs_to :project | |
belongs_to :project | |
end | |
class Department | |
has_many :project_departments | |
has_many :projects, through: :project_departments | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment