Module: NuecaRailsInterfaces::V2::Pagination::BaseAdapter

Included in:
KaminariAdapter, PagyAdapter, WillPaginateAdapter
Defined in:
lib/nueca_rails_interfaces/v2/pagination/base_adapter.rb

Overview

Base adapter module for pagination strategies Modules must implement the .paginate(collection, page, per_page) method

Instance Method Summary collapse

Instance Method Details

#paginate(collection, page, per_page) ⇒ ActiveRecord::Relation

Paginate the collection based on the provided page and per page values.

Parameters:

  • collection (ActiveRecord::Relation)

    The collection to be paginated.

  • page (Integer)

    The page number.

  • per_page (Integer)

    The number of records per page.

Returns:

  • (ActiveRecord::Relation)

    The paginated collection.

Raises:

  • (NotImplementedError)


14
15
16
# File 'lib/nueca_rails_interfaces/v2/pagination/base_adapter.rb', line 14

def paginate(collection, page, per_page)
  raise NotImplementedError, "#{name} must implement the .paginate(collection, page, per_page) method"
end