Sha256: 9a12434a1f1bacf559caceb623b1a5cfcd2f632e893ac10b85e516ac3f3a16b4

Contents?: true

Size: 1.45 KB

Versions: 17

Compression:

Stored size: 1.45 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

17 entries across 17 versions & 1 rubygems

Version Path
phcpress-7.1.2 app/controllers/phcpress/modules/categories_controller.rb
phcpress-7.1.1 app/controllers/phcpress/modules/categories_controller.rb
phcpress-7.1.0 app/controllers/phcpress/modules/categories_controller.rb
phcpress-7.0.0 app/controllers/phcpress/modules/categories_controller.rb
phcpress-6.7.3 app/controllers/phcpress/modules/categories_controller.rb
phcpress-6.7.2 app/controllers/phcpress/modules/categories_controller.rb
phcpress-6.7.1 app/controllers/phcpress/modules/categories_controller.rb
phcpress-6.7.0 app/controllers/phcpress/modules/categories_controller.rb
phcpress-6.6.6 app/controllers/phcpress/modules/categories_controller.rb
phcpress-6.6.5 app/controllers/phcpress/modules/categories_controller.rb
phcpress-6.6.4 app/controllers/phcpress/modules/categories_controller.rb
phcpress-6.6.3 app/controllers/phcpress/modules/categories_controller.rb
phcpress-6.6.1 app/controllers/phcpress/modules/categories_controller.rb
phcpress-6.6.0 app/controllers/phcpress/modules/categories_controller.rb
phcpress-6.5.1 app/controllers/phcpress/modules/categories_controller.rb
phcpress-6.5.0 app/controllers/phcpress/modules/categories_controller.rb
phcpress-6.4.5 app/controllers/phcpress/modules/categories_controller.rb