Sha256: 50f7dd5490d0c94e4932d1df4432e7d1dc58ddc9dd97cdf73a2818f02f486a8f

Contents?: true

Size: 1.31 KB

Versions: 1

Compression:

Stored size: 1.31 KB

Contents

module LesliCalendar
  class AgendasController < ApplicationController
    before_action :set_agenda, only: %i[ show edit update destroy ]

    # GET /agendas
    def index
      @agendas = Agenda.all
    end

    # GET /agendas/1
    def show
    end

    # GET /agendas/new
    def new
      @agenda = Agenda.new
    end

    # GET /agendas/1/edit
    def edit
    end

    # POST /agendas
    def create
      @agenda = Agenda.new(agenda_params)

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

    # PATCH/PUT /agendas/1
    def update
      if @agenda.update(agenda_params)
        redirect_to @agenda, notice: "Agenda was successfully updated.", status: :see_other
      else
        render :edit, status: :unprocessable_entity
      end
    end

    # DELETE /agendas/1
    def destroy
      @agenda.destroy
      redirect_to agendas_url, notice: "Agenda was successfully destroyed.", status: :see_other
    end

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

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

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
lesli_calendar-0.2.2 app/controllers/lesli_calendar/agendas_controller.rb