Skip to content

Instantly share code, notes, and snippets.

@rojotek
Created May 15, 2014 21:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rojotek/8b666b4ae099fe6d28d9 to your computer and use it in GitHub Desktop.
Save rojotek/8b666b4ae099fe6d28d9 to your computer and use it in GitHub Desktop.
Simple model for has_one discussion.
class Employee
belongs_to: :department
end
class Departmet
belongs_to :organization
has_many :employees
end
class Organization
has_many :departments
has_many :employees through: :departments
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment