Sha256: bc3f3c27c51fc13e91b48fee4d582e1806db2014f7266d54714e6db7d17311e4

Contents?: true

Size: 445 Bytes

Versions: 1

Compression:

Stored size: 445 Bytes

Contents

module DataTables
  module ActiveModelSerializers
    class Adapter
      class Pagination

        attr_reader :collection

        def initialize(serializer)
          @collection = serializer.object
        end

        def as_h
          {
            recordsTotal: collection&.total_entries&.to_i,
            recordsFiltered: @collection&.unscope(:limit, :offset)&.count_estimate&.to_i
          }
        end

      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
data_tables-responder-0.3.0 lib/data_tables/active_model_serializers/adapter/pagination.rb