module WillPaginate::Finders::DataMapper

Protected Instance Methods

wp_count(options) click to toggle source
# File lib/will_paginate/finders/data_mapper.rb, line 20
def wp_count(options) #:nodoc
  count_options = options.except(:count, :order)
  # merge the hash found in :count
  count_options.update options[:count] if options[:count]

  count_options.empty?? count() : count(count_options)
end
wp_query(options, pager, args, &block) click to toggle source
# File lib/will_paginate/finders/data_mapper.rb, line 10
def wp_query(options, pager, args, &block) #:nodoc
  find_options = options.except(:count).update(:offset => pager.offset, :limit => pager.per_page) 

  pager.replace all(find_options, &block)
  
  unless pager.total_entries
    pager.total_entries = wp_count(options)
  end
end