From d7470ae3aa16d40e961c52b038f23e0188ebb67e Mon Sep 17 00:00:00 2001 From: Bryan Larsen Date: Mon, 3 Jun 2013 16:38:26 +0200 Subject: [PATCH] users-have-many-projects We also need the other end of this association, in the User model: SHOW_PATCH --- app/models/user.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/app/models/user.rb b/app/models/user.rb index e406a43..6bf0d8b 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -14,6 +14,7 @@ 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 # This gives admin rights and an :active state to the first sign-up. # Just remove it if you don't want that