Last active
December 16, 2015 14:29
-
-
Save telagraphic/5448986 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Project < ActiveRecord::Base | |
attr_accessible :description, :name | |
has_many :user_projects | |
has_many :users, :through => :user_projects | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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