Sha256: 017e1d5287204aa08c9f6a03dffa6bf8b718162f59e839a44dbae0d4b648d59f
Contents?: true
Size: 1.28 KB
Versions: 1
Compression:
Stored size: 1.28 KB
Contents
module LesliDriver class EventsController < ApplicationController before_action :set_event, only: %i[ show edit update destroy ] # GET /events def index @events = Event.all end # GET /events/1 def show end # GET /events/new def new @event = Event.new end # GET /events/1/edit def edit end # POST /events def create @event = Event.new(event_params) if @event.save redirect_to @event, notice: "Event was successfully created." else render :new, status: :unprocessable_entity end end # PATCH/PUT /events/1 def update if @event.update(event_params) redirect_to @event, notice: "Event was successfully updated.", status: :see_other else render :edit, status: :unprocessable_entity end end # DELETE /events/1 def destroy @event.destroy redirect_to events_url, notice: "Event was successfully destroyed.", status: :see_other end private # Use callbacks to share common setup or constraints between actions. def set_event @event = Event.find(params[:id]) end # Only allow a list of trusted parameters through. def event_params params.fetch(:event, {}) end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
lesli_driver-0.2.0 | app/controllers/lesli_driver/events_controller.rb |