# File lib/will_paginate/data_mapper.rb, line 45 def offset query.offset end
# File lib/will_paginate/data_mapper.rb, line 37 def paginated? !current_page.nil? end
# File lib/will_paginate/data_mapper.rb, line 41 def per_page query.limit || model.per_page end
# File lib/will_paginate/data_mapper.rb, line 63 def to_a ::WillPaginate::Collection.create(current_page, per_page) do |col| col.replace super col.total_entries ||= total_entries end end
# File lib/will_paginate/data_mapper.rb, line 49 def total_entries @total_entries ||= begin if loaded? and @array.size < per_page and (current_page == 1 or @array.size > 0) offset + @array.size else clean_query = query.merge(:order => []) # seems like the only way clean_query.instance_variable_set('@limit', nil) clean_query.instance_variable_set('@offset', 0) new_collection(clean_query).count end end end
Generated with the Darkfish Rdoc Generator 2.