Project

General

Profile

Patch #22850 » patches.patch

Pavel Rosický, 2016-05-25 18:19

View differences:

app/models/member_role.rb (working copy)
72 72
  end
73 73

  
74 74
  def remove_inherited_roles
75
    MemberRole.where(:inherited_from => id).group_by(&:member).
76
        each do |member, member_roles|
77
      member_roles.each(&:destroy)
75
    MemberRole.where(:inherited_from => id).order(:member_id).each do |member_role|
76
      member_role.destroy
78 77
    end
79 78
  end
80 79
end
app/models/project.rb (working copy)
804 804
  end
805 805

  
806 806
  def remove_inherited_member_roles
807
    member_roles = memberships.map(&:member_roles).flatten
807
    member_roles = MemberRole.where(:member_id => membership_ids).to_a
808 808
    member_role_ids = member_roles.map(&:id)
809 809
    member_roles.each do |member_role|
810 810
      if member_role.inherited_from && !member_role_ids.include?(member_role.inherited_from)
db/migrate/20160519091249_add_index_on_member_roles_inherited_from.rb (working copy)
1
class AddIndexOnMemberRolesInheritedFrom < ActiveRecord::Migration
2
  def change
3
    add_index :member_roles, :inherited_from
4
  end
5
end
(2-2/4)