Class: ActiveRecord::SearchService::Paginate

Inherits:
Object
  • Object
show all
Defined in:
app/services/active_record/search_service.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(page, per_page) ⇒ Paginate

Returns a new instance of Paginate.



85
86
87
88
# File 'app/services/active_record/search_service.rb', line 85

def initialize(page, per_page)
  @page = page
  @per_page = per_page
end

Instance Attribute Details

#pageObject (readonly)

Returns the value of attribute page.



83
84
85
# File 'app/services/active_record/search_service.rb', line 83

def page
  @page
end

#per_pageObject (readonly)

Returns the value of attribute per_page.



83
84
85
# File 'app/services/active_record/search_service.rb', line 83

def per_page
  @per_page
end

Instance Method Details

#apply(relation) ⇒ Object



90
91
92
# File 'app/services/active_record/search_service.rb', line 90

def apply(relation)
  relation.page(page).per(per_page)
end