diff options
author | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2015-02-05 16:49:41 -0800 |
---|---|---|
committer | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2015-02-05 16:49:41 -0800 |
commit | e0aa5c371ea1c633a0648f13cd7bea35f3aea75c (patch) | |
tree | a21b09e71748e0e55377b550cd61da509d38169d | |
parent | 62ed1c537e9b8aa85d354b377f18083fb71b8e05 (diff) | |
download | gitlab-ce-e0aa5c371ea1c633a0648f13cd7bea35f3aea75c.tar.gz |
Fix method overlap for issue sorting
-rw-r--r-- | app/models/concerns/internal_id.rb | 1 | ||||
-rw-r--r-- | app/models/concerns/sortable.rb | 4 | ||||
-rw-r--r-- | app/models/issue.rb | 1 | ||||
-rw-r--r-- | app/models/merge_request.rb | 1 | ||||
-rw-r--r-- | app/models/milestone.rb | 1 |
5 files changed, 5 insertions, 3 deletions
diff --git a/app/models/concerns/internal_id.rb b/app/models/concerns/internal_id.rb index e86357e3dee..821ed54fb98 100644 --- a/app/models/concerns/internal_id.rb +++ b/app/models/concerns/internal_id.rb @@ -1,6 +1,5 @@ module InternalId extend ActiveSupport::Concern - include Sortable included do validate :set_iid, on: :create diff --git a/app/models/concerns/sortable.rb b/app/models/concerns/sortable.rb index 49001cabc7c..dc46b2e5463 100644 --- a/app/models/concerns/sortable.rb +++ b/app/models/concerns/sortable.rb @@ -17,7 +17,7 @@ module Sortable end module ClassMethods - def sort(method) + def order_by(method) case method.to_s when 'name' then order_name_asc when 'recent' then order_recent @@ -25,7 +25,7 @@ module Sortable when 'recent_updated' then order_recent_updated when 'oldest_updated' then order_oldest_updated else - self + all end end end diff --git a/app/models/issue.rb b/app/models/issue.rb index 8a9e969248c..19e43ebd788 100644 --- a/app/models/issue.rb +++ b/app/models/issue.rb @@ -24,6 +24,7 @@ class Issue < ActiveRecord::Base include Issuable include InternalId include Taskable + include Sortable ActsAsTaggableOn.strict_case_match = true diff --git a/app/models/merge_request.rb b/app/models/merge_request.rb index ad2e8d7879b..f758126cfeb 100644 --- a/app/models/merge_request.rb +++ b/app/models/merge_request.rb @@ -28,6 +28,7 @@ class MergeRequest < ActiveRecord::Base include Issuable include Taskable include InternalId + include Sortable belongs_to :target_project, foreign_key: :target_project_id, class_name: "Project" belongs_to :source_project, foreign_key: :source_project_id, class_name: "Project" diff --git a/app/models/milestone.rb b/app/models/milestone.rb index 8fd3e56d2ee..9bbb2bafb98 100644 --- a/app/models/milestone.rb +++ b/app/models/milestone.rb @@ -15,6 +15,7 @@ class Milestone < ActiveRecord::Base include InternalId + include Sortable belongs_to :project has_many :issues |