summaryrefslogtreecommitdiffstats
path: root/app/models
diff options
context:
space:
mode:
Diffstat (limited to 'app/models')
-rw-r--r--app/models/member.rb6
1 files changed, 4 insertions, 2 deletions
diff --git a/app/models/member.rb b/app/models/member.rb
index 06b90bf55..b19f78c6b 100644
--- a/app/models/member.rb
+++ b/app/models/member.rb
@@ -184,9 +184,11 @@ class Member < ActiveRecord::Base
project_ids = Array.wrap(attributes[:project_ids] || attributes[:project_id])
role_ids = attributes[:role_ids]
project_ids.each do |project_id|
- members << Member.new(:principal => principal, :role_ids => role_ids, :project_id => project_id)
+ member = Member.find_or_new(project_id, principal)
+ member.role_ids |= role_ids
+ member.save
+ members << member
end
- principal.members << members
end
members
end