Rails4: replace deprecated #connection from Project model

DEPRECATION WARNING: #connection is deprecated in favour of accessing it via the class.

git-svn-id: http://svn.redmine.org/redmine/trunk@12719 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Toshi MARUYAMA 2014-01-27 01:08:09 +00:00
parent b1d0107ac0
commit f5c5393d09
1 changed files with 1 additions and 1 deletions

View File

@ -492,7 +492,7 @@ class Project < ActiveRecord::Base
# Deletes all project's members # Deletes all project's members
def delete_all_members def delete_all_members
me, mr = Member.table_name, MemberRole.table_name me, mr = Member.table_name, MemberRole.table_name
connection.delete("DELETE FROM #{mr} WHERE #{mr}.member_id IN (SELECT #{me}.id FROM #{me} WHERE #{me}.project_id = #{id})") ActiveRecord::Base.connection.delete("DELETE FROM #{mr} WHERE #{mr}.member_id IN (SELECT #{me}.id FROM #{me} WHERE #{me}.project_id = #{id})")
Member.delete_all(['project_id = ?', id]) Member.delete_all(['project_id = ?', id])
end end