From 958e801fc7aab88b70bfea34365b0a1da1ed1d25 Mon Sep 17 00:00:00 2001 From: JiangRu Date: Wed, 20 Jul 2016 15:24:39 +0800 Subject: [PATCH] fix albums sort by rand --- app/controllers/galleries_controller.rb | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/app/controllers/galleries_controller.rb b/app/controllers/galleries_controller.rb index 1840757..bf6fa04 100644 --- a/app/controllers/galleries_controller.rb +++ b/app/controllers/galleries_controller.rb @@ -1,6 +1,12 @@ class GalleriesController < ApplicationController def index - albums = Album.filter_by_categories + # albums = Album.filter_by_categories + + params = OrbitHelper.params + + albums = Album.filter_by_categories([],false).filter_by_tags.sample(OrbitHelper.page_data_count) + albums = Kaminari.paginate_array(albums).page(params[:page]).per(OrbitHelper.page_data_count) + galleries = albums.collect do |a| { "album-name" => a.name,