From b8ce888d98a5488ff12eb7d7a45d5c3eab9ca2bb Mon Sep 17 00:00:00 2001 From: Jean-Philippe Lang Date: Sun, 18 Dec 2011 15:02:46 +0000 Subject: Use scoped method instead of merge_conditions. git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@8290 e93f8b46-1217-0410-a6f0-8f06a7374b81 --- app/models/issue.rb | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/app/models/issue.rb b/app/models/issue.rb index aa1a3b93c..3b4e07023 100644 --- a/app/models/issue.rb +++ b/app/models/issue.rb @@ -869,12 +869,12 @@ class Issue < ActiveRecord::Base def self.update_versions(conditions=nil) # Only need to update issues with a fixed_version from # a different project and that is not systemwide shared - Issue.all(:conditions => merge_conditions("#{Issue.table_name}.fixed_version_id IS NOT NULL" + - " AND #{Issue.table_name}.project_id <> #{Version.table_name}.project_id" + - " AND #{Version.table_name}.sharing <> 'system'", - conditions), - :include => [:project, :fixed_version] - ).each do |issue| + Issue.scoped(:conditions => conditions).all( + :conditions => "#{Issue.table_name}.fixed_version_id IS NOT NULL" + + " AND #{Issue.table_name}.project_id <> #{Version.table_name}.project_id" + + " AND #{Version.table_name}.sharing <> 'system'", + :include => [:project, :fixed_version] + ).each do |issue| next if issue.project.nil? || issue.fixed_version.nil? unless issue.project.shared_versions.include?(issue.fixed_version) issue.init_journal(User.current) -- cgit v1.2.3