Sha256: 0ee214835f47c9612e0d8b1baa5f245e1cab971688b3d02091d874f1caab3b1b

Contents?: true

Size: 724 Bytes

Versions: 6

Compression:

Stored size: 724 Bytes

Contents

require_dependency "prosperity/application_controller"

module Prosperity
  class DashboardGraphsController < ApplicationController
    before_action :get_objs
    def create
      DashboardGraph.create!(graph: @graph, dashboard: @dashboard)
      redirect_to edit_dashboard_path(@dashboard)  
    end

    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

    private
    def get_objs
      @graph = Graph.find(params[:graph_id])
      @dashboard = Dashboard.find(params[:dashboard_id])
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
prosperity-0.0.7 app/controllers/prosperity/dashboard_graphs_controller.rb
prosperity-0.0.6 app/controllers/prosperity/dashboard_graphs_controller.rb
prosperity-0.0.5 app/controllers/prosperity/dashboard_graphs_controller.rb
prosperity-0.0.4 app/controllers/prosperity/dashboard_graphs_controller.rb
prosperity-0.0.3 app/controllers/prosperity/dashboard_graphs_controller.rb
prosperity-0.0.2 app/controllers/prosperity/dashboard_graphs_controller.rb