Class: Admin::PostCategoriesController
- Inherits:
-
ApplicationController
- Object
- ApplicationController
- Admin::PostCategoriesController
- Defined in:
- app/controllers/admin/post_categories_controller.rb
Instance Method Summary collapse
Instance Method Details
#create ⇒ Object
31 32 33 34 35 36 37 38 39 |
# File 'app/controllers/admin/post_categories_controller.rb', line 31 def create @post_category = SpudPostCategory.new(category_params) if @post_category.save flash.now[:notice] = 'Post Category was successfully created' respond_with @post_category, location: admin_post_categories_path else render 'new', status: :unprocessable_entity end end |
#destroy ⇒ Object
41 42 43 44 45 46 47 48 49 |
# File 'app/controllers/admin/post_categories_controller.rb', line 41 def destroy if @post_category.destroy flash.now[:notice] = 'Post Category was successfully deleted' @post_categories = SpudPostCategory.ordered render 'index' else respond_with @post_category, location: admin_post_categories_path end end |
#edit ⇒ Object
13 14 15 |
# File 'app/controllers/admin/post_categories_controller.rb', line 13 def edit respond_with @post_category end |
#index ⇒ Object
8 9 10 11 |
# File 'app/controllers/admin/post_categories_controller.rb', line 8 def index @post_categories = SpudPostCategory.ordered respond_with @post_categories end |
#new ⇒ Object
26 27 28 29 |
# File 'app/controllers/admin/post_categories_controller.rb', line 26 def new @post_category = SpudPostCategory.new respond_with @post_category end |
#update ⇒ Object
17 18 19 20 21 22 23 24 |
# File 'app/controllers/admin/post_categories_controller.rb', line 17 def update if @post_category.update(category_params) flash.now[:notice] = 'Post Category was successfully updated' respond_with @post_category, location: admin_post_categories_path else render 'new', status: :unprocessable_entity end end |