diff options
author | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2011-12-18 15:02:46 +0000 |
---|---|---|
committer | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2011-12-18 15:02:46 +0000 |
commit | b8ce888d98a5488ff12eb7d7a45d5c3eab9ca2bb (patch) | |
tree | 656ce0420e8d182b7f2683f8c0ddd63f35e6bedb | |
parent | e75549cc8ec42f1398734796f2e456e187dfd13c (diff) | |
download | redmine-b8ce888d98a5488ff12eb7d7a45d5c3eab9ca2bb.tar.gz redmine-b8ce888d98a5488ff12eb7d7a45d5c3eab9ca2bb.zip |
Use scoped method instead of merge_conditions.
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@8290 e93f8b46-1217-0410-a6f0-8f06a7374b81
-rw-r--r-- | app/models/issue.rb | 12 |
1 files 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) |