Fix archive front end query for multiple categories

This commit is contained in:
chris 2013-03-20 15:37:34 +08:00
parent 90f08c96fc
commit e71b002438
1 changed files with 2 additions and 2 deletions

View File

@ -23,12 +23,12 @@ class Panel::Archive::FrontEnd::ArchiveFilesController < OrbitWidgetController
@tag = ArchiveTag.find(params[:tag_id]) rescue nil
@tag = ArchiveTag.where(key: params[:tag_id])[0] unless @tag
@archive_files = @tag.archive_files.can_display.desc( :is_top ).page( params[:page_main] ).per(@page_num)
@archive_files = @archive_files.can_display.where(:archive_file_category_id => params[:category_id]).desc( :is_top ).page( params[:page_main] ).per(@page_num)
@archive_files = @archive_files.can_display.where(:archive_file_category_id.in => params[:category_id]).desc( :is_top ).page( params[:page_main] ).per(@page_num)
@current_category = ArchiveFileCategory.from_id(params[:category_id]) rescue nil
elsif !params[:category_id].blank?
@archive_files = ArchiveFile.can_display.where(:archive_file_category_id => params[:category_id]).desc( :is_top ).page( params[:page_main] ).per(@page_num)
@archive_files = ArchiveFile.can_display.where(:archive_file_category_id.in => params[:category_id]).desc( :is_top ).page( params[:page_main] ).per(@page_num)
@current_category = ArchiveFileCategory.from_id(params[:category_id]) rescue nil
elsif !params[:tag_id].blank?
@tag = ArchiveTag.find(params[:tag_id]) rescue nil