Module: WithScopedQueries::Page
- Defined in:
- app/models/concerns/with_scoped_queries/page.rb
Class Method Summary collapse
Class Method Details
.add_queriable_attributes_to(klass, _) ⇒ Object
11 12 13 |
# File 'app/models/concerns/with_scoped_queries/page.rb', line 11 def self.add_queriable_attributes_to(klass, _) klass.queriable_attributes.merge!(page: [:page, :limit]) end |
.query_by(params, current_scope, _) ⇒ Object
2 3 4 5 6 7 8 9 |
# File 'app/models/concerns/with_scoped_queries/page.rb', line 2 def self.query_by(params, current_scope, _) if params[:limit].present? current_scope else page_param = params[:page] || 1 current_scope.page(page_param).per(10) end end |