fix for infinite loop if less images
This commit is contained in:
parent
269f7c5121
commit
6da1ceb13f
|
@ -44,7 +44,7 @@ class GalleriesController < ApplicationController
|
||||||
albums.each do |album|
|
albums.each do |album|
|
||||||
total_images = total_images + album.album_images.count
|
total_images = total_images + album.album_images.count
|
||||||
end
|
end
|
||||||
total_images = counts > 9 ? 9 : counts
|
counts = counts > total_images ? counts : total_images
|
||||||
while images.count < counts and images.count < AlbumImage.count
|
while images.count < counts and images.count < AlbumImage.count
|
||||||
albums.each do |album|
|
albums.each do |album|
|
||||||
img = album.album_images.sample
|
img = album.album_images.sample
|
||||||
|
|
Loading…
Reference in New Issue