Module: Core::Endpoint::BasicHandler::Paged
- Included in:
- Core::Endpoint::Base::ModelBehaviour::Handler, Actions::Bound::Handler, Associations::HasMany::Handler
- Defined in:
- app/api/core/endpoint/basic_handler/paged.rb
Defined Under Namespace
Classes: PagedTarget
Constant Summary collapse
- ACTION_NAME_TO_PAGE_METHOD =
[ page_accessor(:last, :total_pages, 1), page_accessor(:previous, :previous_page), page_accessor(:next, :next_page), page_accessor(:read, :current_page, 1) ].freeze
Class Method Summary collapse
Class Method Details
.page_accessor(action, will_paginate_method, default_value = nil) ⇒ Object
3 4 5 6 7 8 |
# File 'app/api/core/endpoint/basic_handler/paged.rb', line 3 def self.page_accessor(action, will_paginate_method, default_value = nil) lambda do |object| page = object.send(will_paginate_method) || default_value page.nil? ? nil : [action, [1, page].max] end end |