Sha256: bad3d3f4f2afe48fddcfd35a1d6e5a8cb2f1046a397a08ff7cda389a0a2606fd

Contents?: true

Size: 1.37 KB

Versions: 1

Compression:

Stored size: 1.37 KB

Contents

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

    # GET /dashboards
    def index
    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

1 entries across 1 versions & 1 rubygems

Version Path
lesli_bell-0.1.0 app/controllers/lesli_bell/dashboards_controller.rb