我已經爲我正在開發的一個網站構建了一個管理面板,而且這一切都非常出色。現在需要有一個作爲「儀表板」的前臺頁面。隨着時間的推移,它將顯示代表各種模型和應用程序部分的不同圖形。它還會顯示各種項目的小列表(需要被調用的客戶等)。我有一個儀表板工作,但我只是想知道是否有更好的方式來做它的軌道。我基本上只是有一個儀表盤控制器:這是最「Rails」做儀表板的方式嗎?
class DashboardController < ApplicationController
def show
@statistics = {}
@statistics[:leads] = Lead.this_month.count
@statistics[:leads_by_day] = Lead.date_count
@statistics[:called_this_month] = Customer.called_this_month.count
end
end
我不希望使用任何寶石,因爲這將需要配置一噸,它需要以某種方式
我會避免哈希值,它們包含的東西,你可能會想一些明確信息=>使用專用對象和/或演示者 – apneadiving