Class: Spud::Admin::PostCategoriesController
- Inherits:
-
ApplicationController
- Object
- ApplicationController
- Spud::Admin::PostCategoriesController
- Defined in:
- app/controllers/spud/admin/post_categories_controller.rb
Instance Method Summary collapse
- #create ⇒ Object
- #destroy ⇒ Object
- #edit ⇒ Object
-
#index ⇒ Object
cache_sweeper :spud_post_category_sweeper, :only => [:create, :update, :destroy].
- #new ⇒ Object
- #update ⇒ Object
Instance Method Details
#create ⇒ Object
35 36 37 38 39 40 41 42 43 |
# File 'app/controllers/spud/admin/post_categories_controller.rb', line 35 def create @post_category = SpudPostCategory.new(category_params) if @post_category.save flash[:notice] = 'Post Category was successfully created' respond_with @post_category, :location => spud_admin_post_categories_path else render 'new', :status => 422 end end |
#destroy ⇒ Object
45 46 47 48 49 50 51 52 53 |
# File 'app/controllers/spud/admin/post_categories_controller.rb', line 45 def destroy if @post_category.destroy flash[:notice] = 'Post Category was successfully deleted' @post_categories = SpudPostCategory.grouped render 'index' else respond_with @post_category, :location => spud_admin_post_categories_path end end |
#edit ⇒ Object
17 18 19 |
# File 'app/controllers/spud/admin/post_categories_controller.rb', line 17 def edit respond_with @post_category end |
#index ⇒ Object
cache_sweeper :spud_post_category_sweeper, :only => [:create, :update, :destroy]
12 13 14 15 |
# File 'app/controllers/spud/admin/post_categories_controller.rb', line 12 def index @post_categories = SpudPostCategory.grouped respond_with @post_categories end |
#new ⇒ Object
30 31 32 33 |
# File 'app/controllers/spud/admin/post_categories_controller.rb', line 30 def new @post_category = SpudPostCategory.new respond_with @post_category end |
#update ⇒ Object
21 22 23 24 25 26 27 28 |
# File 'app/controllers/spud/admin/post_categories_controller.rb', line 21 def update if @post_category.update_attributes(category_params) flash[:notice] = 'Post Category was successfully updated' respond_with @post_category, :location => spud_admin_post_categories_path else render 'new', :status => 422 end end |