Class: Katalyst::Tables::Collection::Pagination::Paginate

Inherits:
Object
  • Object
show all
Defined in:
app/models/concerns/katalyst/tables/collection/pagination.rb

Overview

:nodoc:

Instance Method Summary collapse

Constructor Details

#initialize(app) ⇒ Paginate

Returns a new instance of Paginate.



53
54
55
# File 'app/models/concerns/katalyst/tables/collection/pagination.rb', line 53

def initialize(app)
  @app = app
end

Instance Method Details

#call(collection) ⇒ Object



57
58
59
60
61
62
63
# File 'app/models/concerns/katalyst/tables/collection/pagination.rb', line 57

def call(collection)
  @collection = @app.call(collection)
  if collection.paginate?
    @collection.pagination, @collection.items = pagy(@collection.items, **collection.paginate_options)
  end
  @collection
end

#paramsObject

pagy shim



66
67
68
# File 'app/models/concerns/katalyst/tables/collection/pagination.rb', line 66

def params
  @collection.attributes.with_indifferent_access
end