lib/query_helper.rb in query_helper-0.2.17 vs lib/query_helper.rb in query_helper-0.2.18
- old
+ new
@@ -182,10 +182,10 @@
def pagination_results(count=@count)
# Set pagination params if they aren't provided
results_per_page = @per_page || count
results_page = @page || 1
- total_pages = (count/(results_per_page.nonzero? || 1).to_f).ceil
+ total_pages = (count.to_i/(results_per_page.nonzero? || 1).to_f).ceil
next_page = results_page + 1 if results_page.between?(1, total_pages - 1)
previous_page = results_page - 1 if results_page.between?(2, total_pages)
first_page = results_page == 1
last_page = results_page >= total_pages
out_of_range = !results_page.between?(1,total_pages)