mongoid/mongoid-scroll

View on GitHub
lib/mongoid/scroll/errors/multiple_sort_fields_error.rb

Summary

Maintainability
A
35 mins
Test Coverage
module Mongoid
  module Scroll
    module Errors
      class MultipleSortFieldsError < Mongoid::Scroll::Errors::Base
        def initialize(opts = {})
          if opts[:sort] && opts[:sort].is_a?(Hash)
            opts = opts.merge(sort: opts[:sort].keys.join(', '))
          end
          super(compose_message('multiple_sort_fields', opts))
        end
      end
    end
  end
end