]> source.dussan.org Git - redmine.git/commitdiff
Rails4: replace deprecated Relation#update_all at Repository model
authorToshi MARUYAMA <marutosijp2@yahoo.co.jp>
Thu, 9 Jan 2014 03:34:58 +0000 (03:34 +0000)
committerToshi MARUYAMA <marutosijp2@yahoo.co.jp>
Thu, 9 Jan 2014 03:34:58 +0000 (03:34 +0000)
git-svn-id: http://svn.redmine.org/redmine/trunk@12546 e93f8b46-1217-0410-a6f0-8f06a7374b81

app/models/repository.rb

index 9ae09e722cef6610532b8f51f3c7f7e6993e8075..4d2ccefaa295c7c3042bf42d4f0db949cce5493e 100644 (file)
@@ -281,9 +281,8 @@ class Repository < ActiveRecord::Base
         new_user_id = h[committer]
         if new_user_id && (new_user_id.to_i != user_id.to_i)
           new_user_id = (new_user_id.to_i > 0 ? new_user_id.to_i : nil)
-          Changeset.update_all(
-               "user_id = #{ new_user_id.nil? ? 'NULL' : new_user_id }",
-               ["repository_id = ? AND committer = ?", id, committer])
+          Changeset.where(["repository_id = ? AND committer = ?", id, committer]).
+            update_all("user_id = #{new_user_id.nil? ? 'NULL' : new_user_id}")
         end
       end
       @committers            = nil