Sha256: 27eb655b5d670bc8f757f7ec1812d454976ef7e8bd1d6b774cd72c602ead6fce

Contents?: true

Size: 1.09 KB

Versions: 8

Compression:

Stored size: 1.09 KB

Contents

class ZonesController < ApplicationController
  before_action :set_zone, only: [:show, :edit, :update, :destroy]

  # GET /zones
  def index
    @zones = Zone.all
  end

  # GET /zones/1
  def show
  end

  # GET /zones/new
  def new
    @zone = Zone.new
  end

  # GET /zones/1/edit
  def edit
  end

  # POST /zones
  def create
    @zone = Zone.new(zone_params)

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

  # PATCH/PUT /zones/1
  def update
    if @zone.update(zone_params)
      redirect_to @zone, notice: 'Zone was successfully updated.'
    else
      render :edit
    end
  end

  # DELETE /zones/1
  def destroy
    @zone.destroy
    redirect_to zones_url, notice: 'Zone was successfully destroyed.'
  end

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

    # Only allow a trusted parameter "white list" through.
    def zone_params
      params.require(:zone).permit(:epom_id, :name, :description, :site_id)
    end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
epom_rails-1.0.0 test/dummy/app/controllers/zones_controller.rb
epom_rails-0.4.9 test/dummy/app/controllers/zones_controller.rb
epom_rails-0.4.8 test/dummy/app/controllers/zones_controller.rb
epom_rails-0.4.7 test/dummy/app/controllers/zones_controller.rb
epom_rails-0.4.6 test/dummy/app/controllers/zones_controller.rb
epom_rails-0.4.5 test/dummy/app/controllers/zones_controller.rb
epom_rails-0.4.2 test/dummy/app/controllers/zones_controller.rb
epom_rails-0.4.1 test/dummy/app/controllers/zones_controller.rb