Skip to content

Instantly share code, notes, and snippets.

@thbishop
Created March 28, 2011 15:26
Show Gist options
  • Select an option

  • Save thbishop/890654 to your computer and use it in GitHub Desktop.

Select an option

Save thbishop/890654 to your computer and use it in GitHub Desktop.
class Group < ActiveRecord::Base
has_many :group_memberships, :dependent => :destroy
has_many :members, :through => :group_memberships, :source => :user
end
class User < ActiveRecord::Base
has_many :group_memberships, :dependent => :destroy
has_many :groups, :through => :group_memberships
# Include default devise modules. Others available are:
# :token_authenticatable, :confirmable, :lockable and :timeoutable
devise :invitable, :database_authenticatable, :registerable,
:recoverable, :rememberable, :validatable
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment