From: Jean-Philippe Lang Date: Wed, 4 Apr 2007 17:46:51 +0000 (+0000) Subject: Fixed User role_for_project method X-Git-Tag: 0.5.0~28 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=4ed89dc2d372ed34d2154f81f71b2a4632b3915e;p=redmine.git Fixed User role_for_project method git-svn-id: http://redmine.rubyforge.org/svn/trunk@416 e93f8b46-1217-0410-a6f0-8f06a7374b81 --- 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