]> source.dussan.org Git - redmine.git/commitdiff
Use existing scopes instead of one-off AR condition (#32628).
authorGo MAEDA <maeda@farend.jp>
Tue, 21 Jan 2020 04:02:53 +0000 (04:02 +0000)
committerGo MAEDA <maeda@farend.jp>
Tue, 21 Jan 2020 04:02:53 +0000 (04:02 +0000)
Patch by Jan Schulz-Hofen.

git-svn-id: http://svn.redmine.org/redmine/trunk@19446 e93f8b46-1217-0410-a6f0-8f06a7374b81

app/models/issue_priority.rb

index 106754293d70c05b8246829a6cca37e73534091a..05be79dd1c5a4c713370a2f134ddfaa06e3f9e16 100644 (file)
@@ -50,7 +50,7 @@ class IssuePriority < Enumeration
   # Updates position_name for active priorities
   # Called from migration 20121026003537_populate_enumerations_position_name
   def self.compute_position_names
-    priorities = where(:active => true).sort_by(&:position)
+    priorities = active
     if priorities.any?
       default = priorities.detect(&:is_default?) || priorities[(priorities.size - 1) / 2]
       priorities.each_with_index do |priority, index|