update can_display scope for status is_top and sort_number
This commit is contained in:
parent
9c5d6cb617
commit
528c7da723
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
Loading…
Reference in New Issue