Skip to content

Commit

Permalink
user-has-many-joined-projects
Browse files Browse the repository at this point in the history
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 committed Nov 14, 2011
1 parent d20f048 commit d310e0c
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions app/models/user.rb
Expand Up @@ -14,6 +14,8 @@ class User < ActiveRecord::Base
has_many :task_assignments, :dependent => :destroy
has_many :tasks, :through => :task_assignments
has_many :projects, :class_name => "Project", :foreign_key => "owner_id"
has_many :project_memberships, :dependent => :destroy
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
Expand Down

0 comments on commit d310e0c

Please sign in to comment.