diff options
author | Grzegorz Bizon <grzesiek.bizon@gmail.com> | 2017-07-20 11:48:23 +0200 |
---|---|---|
committer | Grzegorz Bizon <grzesiek.bizon@gmail.com> | 2017-07-20 11:48:23 +0200 |
commit | 54efa041d70707eb28326bb23220ebe8d6efb8aa (patch) | |
tree | 63b1bc838861f2393b5bc283778299e4cf96a70f /app/models/concerns/sortable.rb | |
parent | bb67b4749b5b4c62d4235c90dc0320967f850cdd (diff) | |
parent | 445cd22c72ca6fbfdcf18d67fa859c4b5b9e2a6c (diff) | |
download | gitlab-ce-54efa041d70707eb28326bb23220ebe8d6efb8aa.tar.gz |
Merge branch 'master' into backstage/gb/migrate-stages-statuses
* master: (319 commits)
remove redundant changelog entries
Merge branch '24570-use-re2-for-user-supplied-regexp-9-3' into 'security-9-3'
Merge branch '33303-404-for-unauthorized-project' into 'security-9-3'
Merge branch '33359-pers-snippet-files-location' into 'security-9-3'
Merge branch 'bvl-remove-appearance-symlink' into 'security-9-3'
Hide description about protected branches to non-member
Update CHANGELOG.md for 9.0.11
Update CHANGELOG.md for 9.1.8
Update CHANGELOG.md for 8.17.7
Update CHANGELOG.md for 9.2.8
Update CHANGELOG.md for 9.3.8
Respect blockquote line breaks in markdown
35209 Add wip message to new navigation preference section
Add github imported projects count to usage data
Add versions to Prometheus metrics doc
Add Bulgarian translations of Pipeline Schedules
Add Esperanto translations of Pipeline Schedules
Add Traditional Chinese in HongKong translations of Pipeline Schedules
Add Simplified Chinese translations of Pipeline Schedules
Resolve "Clarify k8s service keys"
...
Conflicts:
db/schema.rb
Diffstat (limited to 'app/models/concerns/sortable.rb')
-rw-r--r-- | app/models/concerns/sortable.rb | 23 |
1 files changed, 0 insertions, 23 deletions
diff --git a/app/models/concerns/sortable.rb b/app/models/concerns/sortable.rb index fdacfa5a194..a155a064032 100644 --- a/app/models/concerns/sortable.rb +++ b/app/models/concerns/sortable.rb @@ -5,25 +5,6 @@ module Sortable extend ActiveSupport::Concern - module DropDefaultScopeOnFinders - # Override these methods to drop the `ORDER BY id DESC` default scope. - # See http://dba.stackexchange.com/a/110919 for why we do this. - %i[find find_by find_by!].each do |meth| - define_method meth do |*args, &block| - return super(*args, &block) if block - - unordered_relation = unscope(:order) - - # We cannot simply call `meth` on `unscope(:order)`, since that is also - # an instance of the same relation class this module is included into, - # which means we'd get infinite recursion. - # We explicitly use the original implementation to prevent this. - original_impl = method(__method__).super_method.unbind - original_impl.bind(unordered_relation).call(*args) - end - end - end - included do # By default all models should be ordered # by created_at field starting from newest @@ -37,10 +18,6 @@ module Sortable scope :order_updated_asc, -> { reorder(updated_at: :asc) } scope :order_name_asc, -> { reorder(name: :asc) } scope :order_name_desc, -> { reorder(name: :desc) } - - # All queries (relations) on this model are instances of this `relation_klass`. - relation_klass = relation_delegate_class(ActiveRecord::Relation) - relation_klass.prepend DropDefaultScopeOnFinders end module ClassMethods |