diff options
author | James Lopez <james@gitlab.com> | 2019-02-21 14:38:11 +0300 |
---|---|---|
committer | James Lopez <james@gitlab.com> | 2019-02-21 14:38:11 +0300 |
commit | 3de4c8d0462aba1e254a255c438c80092109edf7 (patch) | |
tree | d8c9103dc3bdfa34b3f13f1ae354305ecefa8819 /app/finders | |
parent | 161851de3632c772248b7f2f0d5614b49bd06a21 (diff) | |
parent | 843f4b94b59255ec27b3bdf22e93180fce74ddca (diff) |
Merge branch '57867-accessing-issue-1-of-gitlab-ce-via-the-api-results-in-500-internal-server-error' into 'master'
Speed up find_by when used on finders
Closes #57867
See merge request gitlab-org/gitlab-ce!25421
Diffstat (limited to 'app/finders')
-rw-r--r-- | app/finders/concerns/finder_methods.rb | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/app/finders/concerns/finder_methods.rb b/app/finders/concerns/finder_methods.rb index 5290313585f..8de3276184d 100644 --- a/app/finders/concerns/finder_methods.rb +++ b/app/finders/concerns/finder_methods.rb @@ -3,13 +3,13 @@ module FinderMethods # rubocop: disable CodeReuse/ActiveRecord def find_by!(*args) - raise_not_found_unless_authorized execute.find_by!(*args) + raise_not_found_unless_authorized execute.reorder(nil).find_by!(*args) end # rubocop: enable CodeReuse/ActiveRecord # rubocop: disable CodeReuse/ActiveRecord def find_by(*args) - if_authorized execute.find_by(*args) + if_authorized execute.reorder(nil).find_by(*args) end # rubocop: enable CodeReuse/ActiveRecord |