Skip to content

Instantly share code, notes, and snippets.

@telagraphic
Last active December 16, 2015 14:29
Show Gist options
  • Save telagraphic/5448986 to your computer and use it in GitHub Desktop.
Save telagraphic/5448986 to your computer and use it in GitHub Desktop.
class Project < ActiveRecord::Base
attr_accessible :description, :name
has_many :user_projects
has_many :users, :through => :user_projects
end
class User < ActiveRecord::Base
attr_accessible :email, :password, :password_confirmation
has_secure_password
validates_uniqueness_of :email
has_many :user_projects
has_many :projects, :through => :user_projects
end
class UserProject < ActiveRecord::Base
belongs_to :project
belongs_to :user
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment