Commit 9240c2c2 authored by Tetiana Chupryna's avatar Tetiana Chupryna

Merge branch '338019-fix-simple-order-builder-bug' into 'master'

Fix SimpleOrderBuilder undefined method error

See merge request gitlab-org/gitlab!68227
parents b9bc6a62 b21dcb36
# frozen_string_literal: true
require 'spec_helper'
RSpec.describe Gitlab::Pagination::Keyset::SimpleOrderBuilder do
context 'when ordering by a CASE expression and id' do
let(:scope) { Vulnerability.order_report_type_asc }
subject(:result) { described_class.build(scope) }
it 'does not raise error' do
expect { result }.not_to raise_error
end
it 'does not support this ordering' do
_, success = result
expect(success).to eq(false)
end
end
end
...@@ -122,6 +122,7 @@ module Gitlab ...@@ -122,6 +122,7 @@ module Gitlab
return unless attribute return unless attribute
return unless tie_breaker_attribute return unless tie_breaker_attribute
return unless attribute.respond_to?(:name)
model_class.column_names.include?(attribute.name.to_s) && model_class.column_names.include?(attribute.name.to_s) &&
arel_table[primary_key].to_s == tie_breaker_attribute.to_s arel_table[primary_key].to_s == tie_breaker_attribute.to_s
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment