Class: ActiveRecord::SearchService::Paginate
- Inherits:
-
Object
- Object
- ActiveRecord::SearchService::Paginate
- Defined in:
- app/services/active_record/search_service.rb
Instance Attribute Summary collapse
-
#page ⇒ Object
readonly
Returns the value of attribute page.
-
#per_page ⇒ Object
readonly
Returns the value of attribute per_page.
Instance Method Summary collapse
- #apply(relation) ⇒ Object
-
#initialize(page, per_page) ⇒ Paginate
constructor
A new instance of Paginate.
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
#page ⇒ Object (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_page ⇒ Object (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 |