summaryrefslogtreecommitdiffstats
path: root/app/models/group.rb
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2010-11-27 14:46:51 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2010-11-27 14:46:51 +0000
commitd24e66370bf7b3af731f3cc238ced64e2bb8d3f2 (patch)
treec986ec56990de76df3fb8c0a0aa6eda0eda89b8f /app/models/group.rb
parent620c48fbbb8e418819e61e68d8488869fe7e2780 (diff)
downloadredmine-d24e66370bf7b3af731f3cc238ced64e2bb8d3f2.tar.gz
redmine-d24e66370bf7b3af731f3cc238ced64e2bb8d3f2.zip
Prevents validation error when adding a user to a group (#6457).
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@4437 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'app/models/group.rb')
-rw-r--r--app/models/group.rb1
1 files changed, 1 insertions, 0 deletions
diff --git a/app/models/group.rb b/app/models/group.rb
index 80e096be8..1b55c2566 100644
--- a/app/models/group.rb
+++ b/app/models/group.rb
@@ -31,6 +31,7 @@ class Group < Principal
def user_added(user)
members.each do |member|
+ next if member.project.nil?
user_member = Member.find_by_project_id_and_user_id(member.project_id, user.id) || Member.new(:project_id => member.project_id, :user_id => user.id)
member.member_roles.each do |member_role|
user_member.member_roles << MemberRole.new(:role => member_role.role, :inherited_from => member_role.id)