Sha256: dc8ad76348caee68d7f95db8123001a53c7f2e5a226ede2553318748213ba78c

Contents?: true

Size: 1.51 KB

Versions: 7

Compression:

Stored size: 1.51 KB

Contents

require_dependency "phcmembers/application_controller"

module Phcmembers
	class Directory::CategoriesController < ApplicationController

		# Security & Action Filters
		# before_filter :authenticate_user!
		layout 'layouts/phcmembers/directory/directory_all.html.erb'
		before_action :set_directory_category, only: [:edit, :update, :destroy]

		# Directory Category Index
		def index
			@directory_categories = Directory::Category.all.order('catname ASC')
		end

		# Directory Category Details
		def show
		end

		# New Directory Category
		def new
			@directory_category = Directory::Category.new
		end

		# Edit Directory Category
		def edit
		end

		# Create Action
		def create
			@directory_category = Directory::Category.new(directory_category_params)
			if @directory_category.save
				redirect_to directory_categories_path, notice: 'Category was successfully created.'
				else
					render :new
			end
		end

		# Update Action
		def update
			if @directory_category.update(directory_category_params)
				redirect_to directory_categories_path, notice: 'Category was successfully updated.'
				else
					render :edit
			end
		end

		# Delete Action
		def destroy
			@directory_category.destroy
			redirect_to directory_categories_path, notice: 'Category was successfully destroyed.'
		end

		private

		# Common Callbacks
		def set_directory_category
			@directory_category = Directory::Category.find(params[:id])
		end

		# whitelist
		def directory_category_params
			params.require(:directory_category).permit(:catname)
		end

	end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
phcmembers-0.9.6 app/controllers/phcmembers/directory/categories_controller.rb
phcmembers-0.8.0 app/controllers/phcmembers/directory/categories_controller.rb
phcmembers-0.6.2 app/controllers/phcmembers/directory/categories_controller.rb
phcmembers-0.6.1 app/controllers/phcmembers/directory/categories_controller.rb
phcmembers-0.6.0 app/controllers/phcmembers/directory/categories_controller.rb
phcmembers-0.5.9 app/controllers/phcmembers/directory/categories_controller.rb
phcmembers-0.5.8 app/controllers/phcmembers/directory/categories_controller.rb