diff --git a/app/models/group.rb b/app/models/group.rb index 0c08a83dc..646e667c3 100644 --- a/app/models/group.rb +++ b/app/models/group.rb @@ -193,7 +193,7 @@ class Group < ActiveRecord::Base deletions = Set.new(deletions.map{|d| map[d]}) @deletions = [] - group_users.delete_if do |gu| + group_users.each do |gu| @deletions << gu if deletions.include?(gu.user_id) end @@ -221,7 +221,7 @@ class Group < ActiveRecord::Base if @deletions @deletions.each do |gu| gu.destroy - User.update_all 'primary_group_id = NULL', ['id = ? AND primary_group_id = ?', gu.user_id, gu.group_id] + User.where('id = ? AND primary_group_id = ?', gu.user_id, gu.group_id).update_all 'primary_group_id = NULL' end end @deletions = nil diff --git a/app/models/topic.rb b/app/models/topic.rb index 7c0185e91..5a9cdbe7f 100644 --- a/app/models/topic.rb +++ b/app/models/topic.rb @@ -200,7 +200,7 @@ class Topic < ActiveRecord::Base modifications: changes.extract!(:category_id, :title) ) - Post.update_all({version: number}, id: first_post_id) + Post.where(id: first_post_id).update_all(version: number) end end