Sha256: a5b69fbc3ed2ec5323b7c9f9212839e1b984aefef63e133900aecbbd5ee9a024
Contents?: true
Size: 938 Bytes
Versions: 17
Compression:
Stored size: 938 Bytes
Contents
# frozen_string_literal: true module Decidim module Core module NeedsApiDefaultOrder private # Add default order to the query in order to avoid random PostgreSQL # ordering between the queries for different pages of results. If some of # the queried records are updated or new records are added between the # API calls to different pages of records, PostgreSQL can randomly change # the order causing duplicates to appear or some records to disappear from # the results unless the order of the records is explicitly defined. # # Note that this needs to be called as the last method before returning # the query so that it will not affect the desired ordering specified in the # GraphQ query. In that case, ordering by ID will be the secondary order # of the records. def add_default_order @query = @query.order(:id) end end end end
Version data entries
17 entries across 17 versions & 1 rubygems