1
0
mirror of https://github.com/meineerde/redmine.git synced 2026-03-11 19:53:07 +00:00

Fixes inherited_from attribute assignation (protected attribute).

git-svn-id: http://redmine.rubyforge.org/svn/branches/work@1375 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Jean-Philippe Lang 2008-04-28 16:02:06 +00:00
parent a10a54b20f
commit ed74c2a8a2
2 changed files with 7 additions and 2 deletions

View File

@ -50,7 +50,9 @@ class Member < ActiveRecord::Base
if principal.is_a? Group
Member.delete_all "inherited_from = #{id}"
principal.users.each do |user|
Member.create! :project => project, :role => role, :principal => user, :inherited_from => id
inherited = Member.new :project => project, :role => role, :principal => user
inherited.inherited_from = id
inherited.save!
end
end
end

View File

@ -85,7 +85,10 @@ class User < ActiveRecord::Base
Member.delete_all "principal_type = 'User' AND principal_id = #{id} AND inherited_from IS NOT NULL"
unless group.nil?
group.memberships.each do |m|
Member.create! :project => m.project, :role => m.role, :principal => self, :inherited_from => m.id
inherited = Member.new :project => m.project, :role => m.role, :principal => self
# protected attribute
inherited.inherited_from = m.id
inherited.save!
end
end
end