lib/relaxdb/paginator.rb
#
# view_keys are used to determine the params for the prev and next links. If a view_key is a symbol
# the key value will be the result of invoking the method named by the symbol on the first / last 
# element in the result set. If a view_key is not a symbol, its value will be used directly.
#
view_keys are used to determine the params for the prev and next links. If a view_key is a symbol
the key value will be the result of invoking the method named by the symbol on the first / last
element in the result set. If a view_key is not a symbol, its value will be used directly.
view_keys are used to determine the params for the prev and next links . If a view_key is a symbol the key value will be the result of invoking the method named by the symbol on the first / last element in the result set . If a view_key is not a symbol its value will be used directly .
def add_next_and_prev(docs, view_name, view_keys)
      unless docs.empty?
        no_docs = docs.size
        offset = docs.offset
        orig_offset = orig_offset(view_name)
        total_doc_count = total_doc_count(view_name)      
        next_exists = !@paginate_params.order_inverted? ? (offset - orig_offset + no_docs < total_doc_count) : true
        next_params = next_exists ? create_next(docs.last, view_keys) : false
        prev_exists = @paginate_params.order_inverted? ? (offset - orig_offset + no_docs < total_doc_count) : 
          (offset - orig_offset == 0 ? false : true)
        prev_params = prev_exists ? create_prev(docs.first, view_keys) : false
      else
        next_exists = prev_exists = false
      end
      add_next_and_prev_meths docs, next_params, prev_params      
    end
def add_next_and_prev ( docs , view_name , view_keys ) unless docs . empty? no_docs = docs . size offset = docs . offset orig_offset = orig_offset ( view_name ) total_doc_count = total_doc_count ( view_name ) next_exists = ! @paginate_params . order_inverted? ? ( offset - orig_offset + no_docs < total_doc_count ) : true next_params = next_exists ? create_next ( docs . last , view_keys ) : false prev_exists = @paginate_params . order_inverted? ? ( offset - orig_offset + no_docs < total_doc_count ) : ( offset - orig_offset == 0 ? false : true ) prev_params = prev_exists ? create_prev ( docs . first , view_keys ) : false else next_exists = prev_exists = false end add_next_and_prev_meths docs , next_params , prev_params end
view_keys are used to determine the params for the prev and next links.
view_keys are used to determine the params for the prev and next links .
docs
<not_specific>
view_name
<not_specific>
view_keys
<not_specific>