diff options
Diffstat (limited to 'app/models/group.rb')
-rw-r--r-- | app/models/group.rb | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/app/models/group.rb b/app/models/group.rb index 0eba591b5..f8b1ee639 100644 --- a/app/models/group.rb +++ b/app/models/group.rb @@ -62,8 +62,11 @@ class Group < Principal def user_removed(user) members.each do |member| - MemberRole.find(:all, :include => :member, - :conditions => ["#{Member.table_name}.user_id = ? AND #{MemberRole.table_name}.inherited_from IN (?)", user.id, member.member_role_ids]).each(&:destroy) + MemberRole. + includes(:member). + where("#{Member.table_name}.user_id = ? AND #{MemberRole.table_name}.inherited_from IN (?)", user.id, member.member_role_ids). + all. + each(&:destroy) end end |