Skip to content

Instantly share code, notes, and snippets.

@tubbo tubbo/models.rb forked from mfifth/models.rb
Last active Jan 25, 2017

Embed
What would you like to do?
class User < ActiveRecord::Base
has_many :memberships
has_many :groups, through: :memberships
end
class Group < ActiveRecord::Base
has_many :memberships
has_many :members, class_name: 'User', through: :memberships
end
class Membership < ActiveRecord::Base
belongs_to :user
belongs_to :group
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.