Sha256: a6e42c3790746a971978773391db70de034de2128082727264b25a232961d014

Contents?: true

Size: 1.4 KB

Versions: 2

Compression:

Stored size: 1.4 KB

Contents

module LesliDriver
  class DashboardsController < ApplicationController
    #before_action :set_dashboard, only: %i[ show edit update destroy ]

    # GET /dashboards
    def index
      @dashboards = Dashboard.all
    end

    # GET /dashboards/1
    def show
    end

    # GET /dashboards/new
    def new
      @dashboard = Dashboard.new
    end

    # GET /dashboards/1/edit
    def edit
    end

    # POST /dashboards
    def create
      @dashboard = Dashboard.new(dashboard_params)

      if @dashboard.save
        redirect_to @dashboard, notice: "Dashboard was successfully created."
      else
        render :new, status: :unprocessable_entity
      end
    end

    # PATCH/PUT /dashboards/1
    def update
      if @dashboard.update(dashboard_params)
        redirect_to @dashboard, notice: "Dashboard was successfully updated.", status: :see_other
      else
        render :edit, status: :unprocessable_entity
      end
    end

    # DELETE /dashboards/1
    def destroy
      @dashboard.destroy
      redirect_to dashboards_url, notice: "Dashboard was successfully destroyed.", status: :see_other
    end

    private
      # Use callbacks to share common setup or constraints between actions.
      def set_dashboard
        @dashboard = Dashboard.find(params[:id])
      end

      # Only allow a list of trusted parameters through.
      def dashboard_params
        params.fetch(:dashboard, {})
      end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
lesli_driver-0.2.0 app/controllers/lesli_driver/dashboards_controller.rb
lesli_driver-0.1.0 app/controllers/lesli_driver/dashboards_controller.rb