Module: Flame::Pagination::ForForms
- Defined in:
- lib/flame/pagination/for_forms.rb
Overview
Mixin for forms
Instance Method Summary collapse
Instance Method Details
#paginate!(page, per_page: 10) ⇒ Object
7 8 9 10 11 12 13 14 15 |
# File 'lib/flame/pagination/for_forms.rb', line 7 def paginate!(page, per_page: 10) @page = page @per_page = per_page pages_count = valid? ? (dataset.count / @per_page.to_f).ceil : 0 @pages_count = pages_count.positive? ? pages_count : 1 [@page.clamp(1, @pages_count), @pages_count] end |