Sha256: 53e7389d5c835fe4b20eab1cd8cb71a125cd9db69b99c31a933f28f327bf00c0

Contents?: true

Size: 1.34 KB

Versions: 1

Compression:

Stored size: 1.34 KB

Contents

require_dependency "terms/application_controller"

module PolicyManager
  class TermsController < ApplicationController
    before_action :set_term, only: [:show, :edit, :update, :destroy]

    # GET /terms
    def index
      @terms = Term.all
    end

    # GET /terms/1
    def show
    end

    # GET /terms/new
    def new
      @term = Term.new
    end

    # GET /terms/1/edit
    def edit
    end

    # POST /terms
    def create
      @term = Term.new(term_params)

      if @term.save
        redirect_to category_term_path(@term.category, @term), notice: 'Term was successfully created.'
      else
        render :new
      end
    end

    # PATCH/PUT /terms/1
    def update
      if @term.update(term_params)
        redirect_to category_term_path(@term.category, @term), notice: 'Term was successfully updated.'
      else
        render :edit
      end
    end

    # DELETE /terms/1
    def destroy
      @term.destroy
      redirect_to category_terms_path(@term.category), notice: 'Term was successfully destroyed.'
    end

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

      # Only allow a trusted parameter "white list" through.
      def term_params
        params.require(:term).permit(:description, :category_id)
      end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
gdpr_rails-0.1.0 app/controllers/policy_manager/terms_controller.rb