diff --git a/app/models/user.rb b/app/models/user.rb index 15f857542..514517de6 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -125,7 +125,8 @@ class User < ActiveRecord::Base end def role_for_project(project) - memberships.detect {|m| m.project_id == project.id} + member = memberships.detect {|m| m.project_id == project.id} + member ? member.role : nil end def pref