Skip to content

Instantly share code, notes, and snippets.

@rojotek
Created May 15, 2014 21:54
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save rojotek/6c82cc0fd9bf38b475c8 to your computer and use it in GitHub Desktop.
has_many through
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