fix for infinite loop if less images

This commit is contained in:
Harry Bomrah 2015-05-25 21:24:19 +08:00
parent 269f7c5121
commit 6da1ceb13f
1 changed files with 1 additions and 1 deletions

View File

@ -44,7 +44,7 @@ class GalleriesController < ApplicationController
albums.each do |album|
total_images = total_images + album.album_images.count
end
total_images = counts > 9 ? 9 : counts
counts = counts > total_images ? counts : total_images
while images.count < counts and images.count < AlbumImage.count
albums.each do |album|
img = album.album_images.sample