Class: Tablets::Data::Processing::Paginate
- Defined in:
- lib/tablets/data/processing/paginate.rb
Overview
Incapsulate relation pagination logic
Instance Method Summary collapse
-
#apply(relation) ⇒ Object
Applies :start and :length from params to relation as offset and limit :length is optional.
Methods inherited from Base
Constructor Details
This class inherits a constructor from Tablets::Data::Processing::Base
Instance Method Details
#apply(relation) ⇒ Object
Applies :start and :length from params to relation as offset and limit :length is optional. Default value is used if no length is provided :start recalculated to match beginnning of page
11 12 13 |
# File 'lib/tablets/data/processing/paginate.rb', line 11 def apply(relation) relation.offset(offset).limit(per_page) end |