Class: PhcdevworksCoreModules::Post::CategoriesController
- Inherits:
-
ApplicationController
- Object
- ActionController::Base
- ApplicationController
- PhcdevworksCoreModules::Post::CategoriesController
- Defined in:
- app/controllers/phcdevworks_core_modules/post/categories_controller.rb
Instance Method Summary collapse
-
#create ⇒ Object
POST /post/categories.
-
#destroy ⇒ Object
DELETE /post/categories/1.
-
#edit ⇒ Object
GET /post/categories/1/edit.
-
#index ⇒ Object
GET /post/categories.
-
#new ⇒ Object
GET /post/categories/new.
-
#show ⇒ Object
GET /post/categories/1.
-
#update ⇒ Object
PATCH/PUT /post/categories/1.
Instance Method Details
#create ⇒ Object
POST /post/categories
31 32 33 34 35 36 37 38 39 40 41 42 43 44 |
# File 'app/controllers/phcdevworks_core_modules/post/categories_controller.rb', line 31 def create @post_category = Post::Category.new(post_category_params) @post_category.user_id = current_user.id @post_category.org_id = current_user.org_id respond_to do |format| if @post_category.save format.html { redirect_to post_categories_path, :flash => { :success => 'Category has been Added.' }} format.json { render :show, status: :created, location: @post_category } else format.html { render :new } format.json { render json: @post_category.errors, status: :unprocessable_entity } end end end |
#destroy ⇒ Object
DELETE /post/categories/1
60 61 62 63 64 65 66 |
# File 'app/controllers/phcdevworks_core_modules/post/categories_controller.rb', line 60 def destroy @post_category.destroy respond_to do |format| format.html { redirect_to post_categories_path, :flash => { :error => 'Categories and Category Connections have all been Removed.' }} format.json { head :no_content } end end |
#edit ⇒ Object
GET /post/categories/1/edit
27 28 |
# File 'app/controllers/phcdevworks_core_modules/post/categories_controller.rb', line 27 def edit end |
#index ⇒ Object
GET /post/categories
13 14 15 |
# File 'app/controllers/phcdevworks_core_modules/post/categories_controller.rb', line 13 def index @post_categories = Post::Category.order('post_category_name ASC') end |
#new ⇒ Object
GET /post/categories/new
22 23 24 |
# File 'app/controllers/phcdevworks_core_modules/post/categories_controller.rb', line 22 def new @post_category = Post::Category.new end |
#show ⇒ Object
GET /post/categories/1
18 19 |
# File 'app/controllers/phcdevworks_core_modules/post/categories_controller.rb', line 18 def show end |
#update ⇒ Object
PATCH/PUT /post/categories/1
47 48 49 50 51 52 53 54 55 56 57 |
# File 'app/controllers/phcdevworks_core_modules/post/categories_controller.rb', line 47 def update respond_to do |format| if @post_category.update(post_category_params) format.html { redirect_to post_categories_path, :flash => { :notice => 'Category has been Updated.' }} format.json { render :show, status: :ok, location: @post_category } else format.html { render :edit } format.json { render json: @post_category.errors, status: :unprocessable_entity } end end end |