diff --git a/app/controllers/galleries_controller.rb b/app/controllers/galleries_controller.rb index 68b23e7..747e690 100644 --- a/app/controllers/galleries_controller.rb +++ b/app/controllers/galleries_controller.rb @@ -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