Class: Prosperity::DashboardGraphsController

Inherits:
ApplicationController show all
Defined in:
app/controllers/prosperity/dashboard_graphs_controller.rb

Instance Method Summary collapse

Instance Method Details

#createObject



6
7
8
9
10
11
12
13
# File 'app/controllers/prosperity/dashboard_graphs_controller.rb', line 6

def create
  dashboard_graph = DashboardGraph.new(graph: @graph, dashboard: @dashboard)

  unless dashboard_graph.save
    set_error(dashboard_graph)
  end
  redirect_to edit_dashboard_path(@dashboard)
end

#destroyObject

Raises:

  • (ActiveRecord::RecordNotFound)


15
16
17
18
19
20
# File 'app/controllers/prosperity/dashboard_graphs_controller.rb', line 15

def destroy
  dashboard_graph = DashboardGraph.where(graph_id: @graph.id, dashboard_id: @dashboard.id).first
  raise ActiveRecord::RecordNotFound unless dashboard_graph
  dashboard_graph.destroy
  redirect_to edit_dashboard_path(@dashboard)  
end