better rounding

git-svn-id: http://svn.barleysodas.com/barleysodas/trunk@109 0f7b21a7-9e3a-4941-bbeb-ce5c7c368fa7
master
andrew 2008-02-01 05:47:51 +00:00
parent b41d0dc841
commit c3ff8be124
1 changed files with 1 additions and 2 deletions

View File

@ -74,8 +74,7 @@ class TagImagesController < ApplicationController
@current_page = params[:page].to_i
@current_page = 1 if @current_page == 0
image_count = TagImage.count(conditions)
@page_count = (image_count.to_f / per_page.to_f + 0.5).to_i
@page_count = 1 if @page_count == 0 and image_count >= 0
@page_count = (image_count.to_f / images_per_page.to_f).round
@tagged_images = TagImage.find :all, :limit => images_per_page,
:conditions => conditions, :order => 'created_at ASC',
:offset => ((@current_page - 1) * images_per_page),