diff options
author | Douglas Barbosa Alexandre <dbalexandre@gmail.com> | 2016-10-14 20:06:26 -0300 |
---|---|---|
committer | Douglas Barbosa Alexandre <dbalexandre@gmail.com> | 2016-10-19 14:58:27 -0200 |
commit | 3c2aaec1f2624ad4817e7ac52120985682afa448 (patch) | |
tree | 45832f21636e5a33557f715a5d95c36c6be290a9 /app/models/label.rb | |
parent | 99e928f103182b58156edb107b55344eaafc6772 (diff) | |
download | gitlab-ce-3c2aaec1f2624ad4817e7ac52120985682afa448.tar.gz |
Fix sorting by label priorities
Diffstat (limited to 'app/models/label.rb')
-rw-r--r-- | app/models/label.rb | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/app/models/label.rb b/app/models/label.rb index ea11d9d7864..1d775a83f96 100644 --- a/app/models/label.rb +++ b/app/models/label.rb @@ -42,6 +42,17 @@ class Label < ActiveRecord::Base where.not(id: prioritized(project).select(:id)) end + def self.left_join_priorities + labels = Label.arel_table + priorities = LabelPriority.arel_table + + label_priorities = labels.join(priorities, Arel::Nodes::OuterJoin). + on(labels[:id].eq(priorities[:label_id])). + join_sources + + joins(label_priorities) + end + alias_attribute :name, :title def self.reference_prefix |