Class: CafeCar::DashboardsController

Inherits:
Object
  • Object
show all
Includes:
Controller
Defined in:
app/controllers/cafe_car/dashboards_controller.rb

Overview

The opt-in dashboard overview. A host defines the dashboard by writing one template — app/views/cafe_car/dashboard/show.html.haml — that composes the metric/chart helpers (and the policy-driven metrics helper). Its existence IS the opt-in: the route always mounts, but with no host template this 404s, so a CRUD-only host never inherits a blank page. An opted-in dashboard authorizes the conventional DashboardPolicy#show?; its model helpers apply each model's policy scope independently.

Constant Summary

Constants included from Controller

Controller::INDEX_VIEWS

Constants included from Controller::Filtering

Controller::Filtering::CONTROL_PARAMS

Instance Method Summary collapse

Methods included from Controller

#batch, #collection_action, #create, #destroy, #edit, #index, #member_action, #new, #options, #respond_with, #update

Instance Method Details

#showObject



18
19
20
21
22
23
24
25
26
# File 'app/controllers/cafe_car/dashboards_controller.rb', line 18

def show
  unless dashboard_template?
    skip_authorization
    return head(:not_found)
  end

  authorize :dashboard, :show?
  render "cafe_car/dashboard/show"
end