fix dashboard without announcement

This commit is contained in:
manson 2014-09-05 11:47:03 +08:00
parent 2761fe06b6
commit f9fd25c29d
1 changed files with 3 additions and 0 deletions

View File

@ -65,6 +65,7 @@ class Admin::DashboardsController < OrbitBackendController
a = {}
total = 0
args.each do |module_app|
next if !Object.const_defined?(module_app.classify)
module_app_class = module_app.classify.constantize
count = module_app_class.count
a.merge!(module_app => count)
@ -76,6 +77,7 @@ class Admin::DashboardsController < OrbitBackendController
def get_recently_updated(*args)
a = {}
args.each do |module_app|
next if !Object.const_defined?(module_app.classify)
module_app_class = module_app.classify.constantize
objects = module_app_class.order_by(:updated_at, :desc).limit(20)
objects.each do |object|
@ -90,6 +92,7 @@ class Admin::DashboardsController < OrbitBackendController
def get_most_visited(*args)
a = {}
args.each do |module_app|
next if !Object.const_defined?(module_app.classify)
module_app_class = module_app.classify.constantize
objects = module_app_class.order_by(:view_count, :desc).limit(20)
objects.each do |object|