Class: Fustrate::Rails::Services::Base::LoadPage

Inherits:
Fustrate::Rails::Services::Base show all
Defined in:
lib/fustrate/rails/services/base.rb

Constant Summary collapse

DEFAULT_ORDER =
nil
DEFAULT_INCLUDES =
nil
RESULTS_PER_PAGE =
25

Instance Method Summary collapse

Instance Method Details

#call(page: nil, includes: nil, scope: nil, order: nil) ⇒ Object



26
27
28
29
30
31
# File 'lib/fustrate/rails/services/base.rb', line 26

def call(page: nil, includes: nil, scope: nil, order: nil)
  (scope || default_scope)
    .reorder(order || default_order)
    .paginate(page: page || params[:page], per_page: self.class::RESULTS_PER_PAGE)
    .includes(includes || self.class::DEFAULT_INCLUDES)
end