Merge pull request from chancancode/fix_deprecated_finder_methods

Remove deprecated finder method calls
This commit is contained in:
Sam 2014-03-27 20:14:30 +11:00
commit fe80e02b75
2 changed files with 3 additions and 3 deletions

View File

@ -193,7 +193,7 @@ class Group < ActiveRecord::Base
deletions = Set.new(deletions.map{|d| map[d]}) deletions = Set.new(deletions.map{|d| map[d]})
@deletions = [] @deletions = []
group_users.delete_if do |gu| group_users.each do |gu|
@deletions << gu if deletions.include?(gu.user_id) @deletions << gu if deletions.include?(gu.user_id)
end end
@ -221,7 +221,7 @@ class Group < ActiveRecord::Base
if @deletions if @deletions
@deletions.each do |gu| @deletions.each do |gu|
gu.destroy 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
end end
@deletions = nil @deletions = nil

View File

@ -200,7 +200,7 @@ class Topic < ActiveRecord::Base
modifications: changes.extract!(:category_id, :title) 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
end end