module Folio::WillPaginate::ActiveRecord::RelationMethods

Public Instance Methods

count() click to toggle source

overrides WillPaginate's weird “ignore limit when counting” behavior. I can't fall back on super in the branch with a limit_value, since that would fall into WillPaginate's lap, but since there is a limit_value, safe enough to just instantiate and check length

Calls superclass method
# File lib/folio/will_paginate/active_record.rb, line 46
def count
  if limit_value
    to_a.size
  else
    super
  end
end
per_page(*args) click to toggle source

overrides Folio::Page's per_page similar to WillPaginate's version, but uses correct semantics for per_page(nil) (vs. per_page()).

# File lib/folio/will_paginate/active_record.rb, line 33
def per_page(*args)
  if args.size > 0
    raise ArgumentError if args.size > 1
    value ||= @klass.per_page
    limit(value)
  end
  limit_value
end