Skip to content

Instantly share code, notes, and snippets.

@DrewWeth
Created June 15, 2014 08:55
Show Gist options
  • Save DrewWeth/c4b82c6235cece5fc7fa to your computer and use it in GitHub Desktop.
Save DrewWeth/c4b82c6235cece5fc7fa to your computer and use it in GitHub Desktop.
class Member < ActiveRecord::Base
has_many :members_in_orgs
has_many :orgs, :through => :members_in_orgs
end
class MembersInOrgs < ActiveRecord::Base
validates_uniqueness_of :member_id, scope: :org_id
belongs_to :orgs
belongs_to :members
end
class Org < ActiveRecord::Base
has_many :members_in_orgs
has_many :members, :through => :members_in_orgs
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment