module SearchObject::Plugin::Paging
Attributes
page[R]
per_page[R]
Public Class Methods
included(base)
click to toggle source
# File lib/search_object/plugin/paging.rb, line 6 def self.included(base) base.extend ClassMethods end
new(options = {})
click to toggle source
Calls superclass method
# File lib/search_object/plugin/paging.rb, line 12 def initialize(options = {}) @page = [options[:page].to_i, 0].max @per_page = self.class.calculate_per_page options[:per_page] super options end
Private Instance Methods
apply_paging(scope)
click to toggle source
# File lib/search_object/plugin/paging.rb, line 25 def apply_paging(scope) scope.limit(per_page).offset(([page, 1].max - 1) * per_page) end
fetch_results()
click to toggle source
Calls superclass method
# File lib/search_object/plugin/paging.rb, line 21 def fetch_results apply_paging super end