Sha256: 4b97a2af0f206630d2e49a63c6da3a3dd371a7d35ac729ebe283c50a6299e18d

Contents?: true

Size: 1.03 KB

Versions: 55

Compression:

Stored size: 1.03 KB

Contents

class WormsController < ApplicationController
  before_action :set_worm, only: [:show, :edit, :update, :destroy]

  # GET /worms
  def index
    @worms = Worm.all
  end

  # GET /worms/1
  def show
  end

  # GET /worms/new
  def new
    @worm = Worm.new
  end

  # GET /worms/1/edit
  def edit
  end

  # POST /worms
  def create
    @worm = Worm.new(worm_params)

    if @worm.save
      redirect_to @worm, notice: 'Worm was successfully created.'
    else
      render :new
    end
  end

  # PATCH/PUT /worms/1
  def update
    if @worm.update(worm_params)
      redirect_to @worm, notice: 'Worm was successfully updated.'
    else
      render :edit
    end
  end

  # DELETE /worms/1
  def destroy
    @worm.destroy
    redirect_to worms_url, notice: 'Worm was successfully destroyed.'
  end

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

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

Version data entries

55 entries across 55 versions & 1 rubygems

Version Path
wordjelly-auth-1.6.0 spec/dummy/app/controllers/worms_controller.rb
wordjelly-auth-1.5.9 spec/dummy/app/controllers/worms_controller.rb
wordjelly-auth-1.5.8 spec/dummy/app/controllers/worms_controller.rb
wordjelly-auth-1.5.7 spec/dummy/app/controllers/worms_controller.rb
wordjelly-auth-1.5.6 spec/dummy/app/controllers/worms_controller.rb
wordjelly-auth-1.5.5 spec/dummy/app/controllers/worms_controller.rb
wordjelly-auth-1.5.4 spec/dummy/app/controllers/worms_controller.rb
wordjelly-auth-1.5.3 spec/dummy/app/controllers/worms_controller.rb
wordjelly-auth-1.5.2 spec/dummy/app/controllers/worms_controller.rb
wordjelly-auth-1.5.1 spec/dummy/app/controllers/worms_controller.rb
wordjelly-auth-1.5.0 spec/dummy/app/controllers/worms_controller.rb
wordjelly-auth-1.4.9 spec/dummy/app/controllers/worms_controller.rb
wordjelly-auth-1.4.8 spec/dummy/app/controllers/worms_controller.rb
wordjelly-auth-1.4.7 spec/dummy/app/controllers/worms_controller.rb
wordjelly-auth-1.4.6 spec/dummy/app/controllers/worms_controller.rb
wordjelly-auth-1.4.5 spec/dummy/app/controllers/worms_controller.rb
wordjelly-auth-1.4.4 spec/dummy/app/controllers/worms_controller.rb
wordjelly-auth-1.4.3 spec/dummy/app/controllers/worms_controller.rb
wordjelly-auth-1.4.2 spec/dummy/app/controllers/worms_controller.rb
wordjelly-auth-1.4.0 spec/dummy/app/controllers/worms_controller.rb