update can_display scope for status is_top and sort_number

This commit is contained in:
manson 2014-06-09 10:01:53 +08:00
parent 9c5d6cb617
commit 528c7da723
2 changed files with 3 additions and 2 deletions

View File

@ -17,7 +17,7 @@ class ArchivesController < ApplicationController
end
end
cats = @categories.collect do |cat|
archives = ArchiveFile.where(:category_id => cat["id"]).collect do |archive|
archives = ArchiveFile.can_display.where(:category_id => cat["id"]).collect do |archive|
statuses = archive.statuses.collect do |status|
{
"archive-status" => status
@ -65,7 +65,7 @@ class ArchivesController < ApplicationController
end
end
cats = @categories.collect do |cat|
archives = ArchiveFile.where(:category_id => cat["id"]).collect do |archive|
archives = ArchiveFile.can_display.where(:category_id => cat["id"]).collect do |archive|
{
"archive-title" => archive.title,
"archive_url" => OrbitHelper.widget_more_url

View File

@ -27,6 +27,7 @@ class ArchiveFile
field :rss2_sn
# scope :can_display,where(is_hidden: false)
scope :can_display, ->{where(is_hidden: false).asc(:sort_number, :title).desc(:is_top)}
# belongs_to :archive_file_category