Sha256: 4dbec7be4ebc85df50294dfdd6df135e8ace36a9c3af74bf056d7b7c503130d7

Contents?: true

Size: 1.41 KB

Versions: 62

Compression:

Stored size: 1.41 KB

Contents

require_dependency "phcpress/application_controller"

module Phcpress
  class Modules::CategoriesController < ApplicationController

    # Security and Filters
    before_action :set_modules_category, only: [:show, :edit, :update, :destroy]

    # Categories Index
    def index
      @modules_categories = Modules::Category.all
    end

    # Categories Show
    def show
    end

    # Categories New
    def new
      @modules_category = Modules::Category.new
    end

    # Categories Edit
    def edit
    end

    # POST
    def create
      @modules_category = Modules::Category.new(modules_category_params)
      if @modules_category.save
        redirect_to modules_categories_url, notice: 'Category was successfully created.'
        else
          render :new
      end
    end

    # PATCH/PUT
    def update
      if @modules_category.update(modules_category_params)
        redirect_to modules_categories_url, notice: 'Category was successfully updated.'
        else
          render :edit
      end
    end

    # DELETE
    def destroy
      @modules_category.destroy
      redirect_to modules_categories_url, notice: 'Category was successfully destroyed.'
    end

    private

    # Common Callbacks
    def set_modules_category
      @modules_category = Modules::Category.find(params[:id])
    end

    # Whitelist
    def modules_category_params
      params.require(:modules_category).permit(:catname)
    end

  end
end

Version data entries

62 entries across 62 versions & 1 rubygems

Version Path
phcpress-50.0.0 app/controllers/phcpress/modules/categories_controller.rb
phcpress-49.0.0 app/controllers/phcpress/modules/categories_controller.rb
phcpress-48.0.0 app/controllers/phcpress/modules/categories_controller.rb
phcpress-47.1.0 app/controllers/phcpress/modules/categories_controller.rb
phcpress-47.0.0 app/controllers/phcpress/modules/categories_controller.rb
phcpress-46.0.0 app/controllers/phcpress/modules/categories_controller.rb
phcpress-45.0.0 app/controllers/phcpress/modules/categories_controller.rb
phcpress-44.0.0 app/controllers/phcpress/modules/categories_controller.rb
phcpress-43.0.0 app/controllers/phcpress/modules/categories_controller.rb
phcpress-42.0.0 app/controllers/phcpress/modules/categories_controller.rb
phcpress-41.0.0 app/controllers/phcpress/modules/categories_controller.rb
phcpress-40.0.0 app/controllers/phcpress/modules/categories_controller.rb
phcpress-39.0.0 app/controllers/phcpress/modules/categories_controller.rb
phcpress-38.0.0 app/controllers/phcpress/modules/categories_controller.rb
phcpress-37.0.0 app/controllers/phcpress/modules/categories_controller.rb
phcpress-36.0.0 app/controllers/phcpress/modules/categories_controller.rb
phcpress-35.0.0 app/controllers/phcpress/modules/categories_controller.rb
phcpress-34.0.0 app/controllers/phcpress/modules/categories_controller.rb
phcpress-33.0.0 app/controllers/phcpress/modules/categories_controller.rb
phcpress-32.0.0 app/controllers/phcpress/modules/categories_controller.rb