Created
January 14, 2011 23:48
-
-
Save gkleiman/780524 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
User: | |
fields: | |
default: name, email, user | |
form: name, email, user | |
relationships: projects, third_party_projects | |
application: wide | |
Project: | |
fields: | |
default: name, user | |
form: name, user | |
relationships: collaborators | |
application: wide | |
ProjectCollaborator: | |
fields: | |
default: user | |
form: user, project | |
filters: project, user |
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 | |
belongs_to :user | |
has_many :project_collaborators, :dependent => :destroy | |
has_many :collaborators, :through => :project_collaborators, :source => :user | |
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 ProjectCollaborator < ActiveRecord::Base | |
belongs_to :user | |
belongs_to :project | |
validates_uniqueness_of :user_id, :scope => :project_id | |
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 | |
has_many :projects, :dependent => :destroy | |
has_many :third_party_projects, :through => :project_collaborators, :dependent => :destroy | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment