Permalink
Browse files

user-has-many-joined-projects

And in the User model (remember that User already has an association called `projects` so we need a new name):

SHOW_PATCH
  • Loading branch information...
bryanlarsen authored and iox committed Jun 3, 2013
1 parent 2286479 commit b39072837da4e9eba270df1bdd647812b585447f
Showing with 2 additions and 0 deletions.
  1. +2 −0 app/models/user.rb
View
@@ -15,6 +15,8 @@ class User < ActiveRecord::Base
has_many :task_assignments, :dependent => :destroy, :inverse_of => :user
has_many :tasks, :through => :task_assignments
has_many :projects, :class_name => "Project", :foreign_key => "owner_id", :inverse_of => :owner
has_many :project_memberships, :dependent => :destroy, :inverse_of => :user
has_many :joined_projects, :through => :project_memberships, :source => :project
# This gives admin rights and an :active state to the first sign-up.
# Just remove it if you don't want that

0 comments on commit b390728

Please sign in to comment.