Skip to content

Instantly share code, notes, and snippets.

@JonasNielsen
Created February 1, 2010 19:54
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 JonasNielsen/291956 to your computer and use it in GitHub Desktop.
Save JonasNielsen/291956 to your computer and use it in GitHub Desktop.
class Enterprise < ActiveRecord::Base
has_many :branches
has_many :people, :through => :branches
end
class Branch < ActiveRecord::Base
has_many :people
belongs_to :enterprise
end
class Person < ActiveRecord::Base
belongs_to :branch, :include => :enterprise
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment