Sha256: a6cffc8d06e55c15c3b362606e9c6f22e3c74b4b4d35491e3df2262e64fda777

Contents?: true

Size: 1.06 KB

Versions: 7

Compression:

Stored size: 1.06 KB

Contents

class EventsController < ApplicationController
  before_action :set_event, only: [: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
    end
  end

  # PATCH/PUT /events/1
  def update
    if @event.update(event_params)
      redirect_to @event, notice: 'Event was successfully updated.'
    else
      render :edit
    end
  end

  # DELETE /events/1
  def destroy
    @event.destroy
    redirect_to events_url, notice: 'Event was successfully destroyed.'
  end

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

    # Only allow a trusted parameter "white list" through.
    def event_params
      params[:event]
    end
end

Version data entries

7 entries across 7 versions & 2 rubygems

Version Path
lazy_crud-0.9.3 spec/support/rails_app/app/controllers/events_controller.rb
lazy_crud-0.9.2 spec/support/rails_app/app/controllers/events_controller.rb
lazy_crud-0.9.1 spec/support/rails_app/app/controllers/events_controller.rb
lazy_crud-0.9.0 spec/support/rails_app/app/controllers/events_controller.rb
authorizable-0.9.2 spec/support/rails_app/app/controllers/events_controller.rb
authorizable-0.9.1 spec/support/rails_app/app/controllers/events_controller.rb
authorizable-0.9.0 spec/support/rails_app/app/controllers/events_controller.rb