Sha256: 029e6487866b5e80b3a2456a7830f766b9a18f8feda5c40cf131b3fd00b324ea

Contents?: true

Size: 714 Bytes

Versions: 4

Compression:

Stored size: 714 Bytes

Contents

require_dependency "prosperity/application_controller"

module Prosperity
  class DashboardsController < ApplicationController
    def index
      @dashboards = Dashboard.all
    end

    def new
      @dashboard = Dashboard.new
    end

    def show
      @dashboard = Dashboard.find(params[:id])
    end

    def edit
      @dashboard = Dashboard.find(params[:id])
    end

    def create
      @dashboard = Dashboard.new
      @dashboard.title = params.fetch(:dashboard, {})[:title]
      @dashboard.default = false
      if @dashboard.save
        redirect_to action: :index
      else
        flash[:error] = @dashboard.errors.full_messages.to_sentence
        render action: :new
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
prosperity-0.0.5 app/controllers/prosperity/dashboards_controller.rb
prosperity-0.0.4 app/controllers/prosperity/dashboards_controller.rb
prosperity-0.0.3 app/controllers/prosperity/dashboards_controller.rb
prosperity-0.0.2 app/controllers/prosperity/dashboards_controller.rb