count with conditions for AR2

git-svn-id: http://svn.barleysodas.com/barleysodas/trunk@159 0f7b21a7-9e3a-4941-bbeb-ce5c7c368fa7
master
andrew 2008-05-07 18:37:20 +00:00
parent a07bba6839
commit 0551d1e10e
1 changed files with 1 additions and 1 deletions

View File

@ -78,7 +78,7 @@ class TagImagesController < ApplicationController
conditions = [ cond_ary.join(' AND '), cond_var ] conditions = [ cond_ary.join(' AND '), cond_var ]
@current_page = params[:page].to_i @current_page = params[:page].to_i
@current_page = 1 if @current_page == 0 @current_page = 1 if @current_page == 0
image_count = TagImage.count(conditions) image_count = TagImage.count(:conditions => 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 @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,