Sha256: 95efc38d7d6888c01959cbbd362d1bb8de2f8587e55cde668935c7b831b6a11e

Contents?: true

Size: 1.12 KB

Versions: 4

Compression:

Stored size: 1.12 KB

Contents

class OthersController < ApplicationController
  before_action :set_other, only: [:show, :edit, :update, :destroy]

  # GET /others
  def index
    @others = Other.all
  end

  # GET /others/1
  def show
  end

  # GET /others/new
  def new
    @other = Other.new
  end

  # GET /others/1/edit
  def edit
  end

  # POST /others
  def create
    @other = Other.new(other_params)

    if @other.save
      redirect_to @other, notice: 'Other was successfully created.'
    else
      render action: 'new'
    end
  end

  # PATCH/PUT /others/1
  def update
    if @other.update(other_params)
      redirect_to @other, notice: 'Other was successfully updated.'
    else
      render action: 'edit'
    end
  end

  # DELETE /others/1
  def destroy
    @other.destroy
    redirect_to others_url, notice: 'Other was successfully destroyed.'
  end

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

    # Only allow a trusted parameter "white list" through.
    def other_params
      params.require(:other).permit(:name, :permalink, :content)
    end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
valid_route-0.0.4 test/dummy/app/controllers/others_controller.rb
valid_route-0.0.3 test/dummy/app/controllers/others_controller.rb
valid_route-0.0.2 test/dummy/app/controllers/others_controller.rb
valid_route-0.0.1 test/dummy/app/controllers/others_controller.rb