Sha256: e368c2a3bfc92b20b69b33ef5e866e479ead7da6b2891d29372d7ba0e16e6fe7

Contents?: true

Size: 816 Bytes

Versions: 4

Compression:

Stored size: 816 Bytes

Contents

require_dependency "prosperity/application_controller"

module Prosperity
  class DashboardGraphsController < ApplicationController
    before_action :get_objs
    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

    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

4 entries across 4 versions & 1 rubygems

Version Path
prosperity-0.0.11 app/controllers/prosperity/dashboard_graphs_controller.rb
prosperity-0.0.10 app/controllers/prosperity/dashboard_graphs_controller.rb
prosperity-0.0.9 app/controllers/prosperity/dashboard_graphs_controller.rb
prosperity-0.0.8 app/controllers/prosperity/dashboard_graphs_controller.rb