]> source.dussan.org Git - redmine.git/commitdiff
Fixed User role_for_project method
authorJean-Philippe Lang <jp_lang@yahoo.fr>
Wed, 4 Apr 2007 17:46:51 +0000 (17:46 +0000)
committerJean-Philippe Lang <jp_lang@yahoo.fr>
Wed, 4 Apr 2007 17:46:51 +0000 (17:46 +0000)
git-svn-id: http://redmine.rubyforge.org/svn/trunk@416 e93f8b46-1217-0410-a6f0-8f06a7374b81

app/models/user.rb

index 15f8575429b7f97d9516245fb87c93addd67513a..514517de6ca7d70d17776df28c7cbf87cbd8edc5 100644 (file)
@@ -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