lib/active_collection/pagination.rb in active_collection-0.2.1 vs lib/active_collection/pagination.rb in active_collection-0.2.3

- old
+ new

@@ -29,11 +29,17 @@ attr_writer :per_page # Loads total entries and calculates the size from that. def size_with_pagination if paginated? - last_page?? size_without_pagination % per_page : per_page + if out_of_bounds? + 0 + elsif last_page? + size_without_pagination % per_page + else + per_page + end else size_without_pagination end end @@ -90,10 +96,10 @@ # true if the collection is the last page. # # may load total_entries if not already loaded. def last_page? - next_page.nil? + !out_of_bounds? && next_page.nil? end # New Collection for current_page - 1 or nil. def previous_page_collection previous_page ? page(previous_page, per_page) : nil