Module: Iord::Paginate

Extended by:
ActiveSupport::Concern
Defined in:
lib/iord/paginate.rb

Instance Method Summary collapse

Instance Method Details

#countObject



72
73
74
# File 'lib/iord/paginate.rb', line 72

def count
  @count ||= create_collection.count
end

#create_collection_with_paginationObject



76
77
78
# File 'lib/iord/paginate.rb', line 76

def create_collection_with_pagination
  create_collection_without_pagination.limit(limit).skip(offset)
end

#limitObject



57
58
59
60
61
62
63
64
65
66
# File 'lib/iord/paginate.rb', line 57

def limit
  if @limit.nil?
    @limit = Integer(params[:limit] ||
                     default(:limit) ||
                     Rails.configuration.try(:iord_pagination_default_limit) ||
                     25)
    collection_url_defaults[:limit] = @limit
  end
  return @limit
end

#offsetObject



68
69
70
# File 'lib/iord/paginate.rb', line 68

def offset
  @offset ||= Integer(params[:offset] || 0)
end