Sha256: df5d76abc7e5f7461ea0548a38daac05c762ff28820caaec3aa7b48fc729ba78

Contents?: true

Size: 1.3 KB

Versions: 48

Compression:

Stored size: 1.3 KB

Contents

require_dependency "phcpresspro/application_controller"

module Phcpresspro
	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

48 entries across 48 versions & 1 rubygems

Version Path
phcpresspro-5.5.2 app/controllers/phcpresspro/modules/categories_controller.rb
phcpresspro-5.5.1 app/controllers/phcpresspro/modules/categories_controller.rb
phcpresspro-5.5.0 app/controllers/phcpresspro/modules/categories_controller.rb
phcpresspro-5.4.2 app/controllers/phcpresspro/modules/categories_controller.rb
phcpresspro-5.4.1 app/controllers/phcpresspro/modules/categories_controller.rb
phcpresspro-5.4.0 app/controllers/phcpresspro/modules/categories_controller.rb
phcpresspro-5.3.4 app/controllers/phcpresspro/modules/categories_controller.rb
phcpresspro-5.3.3 app/controllers/phcpresspro/modules/categories_controller.rb
phcpresspro-5.3.2 app/controllers/phcpresspro/modules/categories_controller.rb
phcpresspro-5.3.1 app/controllers/phcpresspro/modules/categories_controller.rb
phcpresspro-5.3.0 app/controllers/phcpresspro/modules/categories_controller.rb
phcpresspro-5.2.3 app/controllers/phcpresspro/modules/categories_controller.rb
phcpresspro-5.2.2 app/controllers/phcpresspro/modules/categories_controller.rb
phcpresspro-5.2.0 app/controllers/phcpresspro/modules/categories_controller.rb
phcpresspro-5.1.2 app/controllers/phcpresspro/modules/categories_controller.rb
phcpresspro-5.1.1 app/controllers/phcpresspro/modules/categories_controller.rb
phcpresspro-5.1.0 app/controllers/phcpresspro/modules/categories_controller.rb
phcpresspro-5.0.3 app/controllers/phcpresspro/modules/categories_controller.rb
phcpresspro-5.0.2 app/controllers/phcpresspro/modules/categories_controller.rb
phcpresspro-5.0.1 app/controllers/phcpresspro/modules/categories_controller.rb