Class: PagedPaginator
- Inherits:
-
Resourcey::Paginator
- Object
- Resourcey::Paginator
- PagedPaginator
- Defined in:
- lib/resourcey/paginator.rb
Instance Method Summary collapse
Methods inherited from Resourcey::Paginator
class_for, #initialize, #parse_params, permit_params
Constructor Details
This class inherits a constructor from Resourcey::Paginator
Instance Method Details
#paginate(scope) ⇒ Object
45 46 47 48 |
# File 'lib/resourcey/paginator.rb', line 45 def paginate(scope) offset = (page - 1) * per_page scope.offset(offset).limit(per_page) end |
#setup(opts) ⇒ Object
40 41 42 43 |
# File 'lib/resourcey/paginator.rb', line 40 def setup(opts) @page = opts[:page].to_i @per_page = opts[:per_page].to_i end |