module PagingCursor::ActiveRecord::SortedResults

Attributes

cursored[RW]
sort_order[RW]

Public Class Methods

new(*a) click to toggle source
Calls superclass method
# File lib/paging_cursor/active_record.rb, line 53
def initialize *a
  self.sort_order = :asc
  self.cursored = false # todo, separate module??
  super *a
end

Public Instance Methods

to_a() click to toggle source
Calls superclass method
# File lib/paging_cursor/active_record.rb, line 59
def to_a
  return super unless self.cursored
  r = ::PagingCursor::Array.new(super)
  if self.sort_order != PagingCursor.config.default_sort_order.to_sym
    r.reverse!
  end
  r
end