From 690b219da08f2b46dc783d361468c817354a8eb5 Mon Sep 17 00:00:00 2001 From: bohung Date: Fri, 30 Oct 2020 08:19:46 +0800 Subject: [PATCH] Fix bug --- app/controllers/galleries_controller.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/controllers/galleries_controller.rb b/app/controllers/galleries_controller.rb index 51baaee..e5ee95d 100644 --- a/app/controllers/galleries_controller.rb +++ b/app/controllers/galleries_controller.rb @@ -50,7 +50,7 @@ class GalleriesController < ApplicationController if albums_with_order.count == page_data_count albums_no_order = [] else - albums_no_order = album_tp.desc(:created_at).where(:order.in=>[-1,nil])[0...(page_data_count - albums_with_order.count)] + albums_no_order = album_tp.desc(:created_at).where(:order.in=>[-1,nil]).page(nil).per(all_count)[0...(page_data_count - albums_with_order.count)] end else start_index = (page_data_count - (with_order_count % page_data_count) + page_data_count*(page_no - 1 - with_order_total_pages))