summaryrefslogtreecommitdiff
path: root/app/models/label.rb
diff options
context:
space:
mode:
Diffstat (limited to 'app/models/label.rb')
-rw-r--r--app/models/label.rb9
1 files changed, 8 insertions, 1 deletions
diff --git a/app/models/label.rb b/app/models/label.rb
index ae07e8f60e1..149fd98ecb3 100644
--- a/app/models/label.rb
+++ b/app/models/label.rb
@@ -39,7 +39,14 @@ class Label < ActiveRecord::Base
end
def self.unprioritized(project)
- where.not(id: prioritized(project).select(:id))
+ labels = Label.arel_table
+ priorities = LabelPriority.arel_table
+
+ label_priorities = labels.join(priorities, Arel::Nodes::OuterJoin).
+ on(labels[:id].eq(priorities[:label_id]).and(priorities[:project_id].eq(project.id))).
+ join_sources
+
+ joins(label_priorities).where(priorities[:priority].eq(nil))
end
def self.left_join_priorities