Sha256: d30cabcfff323cbbd65734cdb841f88d285ad9be0b7256433c1297a7415f8cc8

Contents?: true

Size: 1.08 KB

Versions: 38

Compression:

Stored size: 1.08 KB

Contents

require_dependency "apidae/application_controller"

module Apidae
  class SelectionsController < ApplicationController
    before_action :set_selection, only: [:show, :edit, :update, :destroy]

    def index
      @selections = Selection.all
    end

    def show
    end

    def new
      @selection = Selection.new
    end

    def edit
    end

    def create
      @selection = Selection.new(selection_params)

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

    def update
      if @selection.update(selection_params)
        redirect_to @selection, notice: 'Selection was successfully updated.'
      else
        render :edit
      end
    end

    def destroy
      @selection.destroy
      redirect_to selections_url, notice: 'Selection was successfully destroyed.'
    end

    private
      def set_selection
        @selection = Selection.find(params[:id])
      end

      def selection_params
        params.require(:selection).permit(:label, :reference, :apidae_id)
      end
  end
end

Version data entries

38 entries across 38 versions & 1 rubygems

Version Path
apidae-0.9.22 app/controllers/apidae/selections_controller.rb
apidae-0.9.21 app/controllers/apidae/selections_controller.rb
apidae-0.9.20 app/controllers/apidae/selections_controller.rb
apidae-0.9.19 app/controllers/apidae/selections_controller.rb
apidae-0.9.18 app/controllers/apidae/selections_controller.rb
apidae-0.9.17 app/controllers/apidae/selections_controller.rb
apidae-0.9.16 app/controllers/apidae/selections_controller.rb
apidae-0.7.8 app/controllers/apidae/selections_controller.rb
apidae-0.7.7 app/controllers/apidae/selections_controller.rb
apidae-0.7.6 app/controllers/apidae/selections_controller.rb
apidae-0.9.15 app/controllers/apidae/selections_controller.rb
apidae-0.9.14 app/controllers/apidae/selections_controller.rb
apidae-0.9.13 app/controllers/apidae/selections_controller.rb
apidae-0.9.12 app/controllers/apidae/selections_controller.rb
apidae-0.9.11 app/controllers/apidae/selections_controller.rb
apidae-0.9.10 app/controllers/apidae/selections_controller.rb
apidae-0.9.9 app/controllers/apidae/selections_controller.rb
apidae-0.9.8 app/controllers/apidae/selections_controller.rb
apidae-0.9.7 app/controllers/apidae/selections_controller.rb
apidae-0.9.6 app/controllers/apidae/selections_controller.rb