minimum number of pages

git-svn-id: http://svn.barleysodas.com/barleysodas/trunk@113 0f7b21a7-9e3a-4941-bbeb-ce5c7c368fa7
master
andrew 2008-02-01 06:26:12 +00:00
parent 74037ae3c6
commit 67fd6cda40
1 changed files with 1 additions and 0 deletions

View File

@ -75,6 +75,7 @@ class TagImagesController < ApplicationController
@current_page = 1 if @current_page == 0 @current_page = 1 if @current_page == 0
image_count = TagImage.count(conditions) image_count = TagImage.count(conditions)
@page_count = (image_count.to_f / images_per_page.to_f).round @page_count = (image_count.to_f / images_per_page.to_f).round
@page_count = 1 if @page_count == 0
@tagged_images = TagImage.find :all, :limit => images_per_page, @tagged_images = TagImage.find :all, :limit => images_per_page,
:conditions => conditions, :order => 'created_at ASC', :conditions => conditions, :order => 'created_at ASC',
:offset => ((@current_page - 1) * images_per_page), :offset => ((@current_page - 1) * images_per_page),