Skip to content

Instantly share code, notes, and snippets.

@davidcelis
Created March 5, 2012 19:59
Show Gist options
  • Save davidcelis/1980704 to your computer and use it in GitHub Desktop.
Save davidcelis/1980704 to your computer and use it in GitHub Desktop.
User.has_many :memberships
User.has_many :groups, :through => :memberships
Membership.belongs_to :user
Membership.belongs_to :group
Group.has_many :memberships
Group.has_many :users, :through => :memberships
>> current_user.memberships # => Gives you the Join models. No idea why you'd need them, but there they are
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment