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
Instance Method Details
#create ⇒ Object
32 33 34 35 36 37 38 39 |
# File 'app/controllers/spud/admin/post_categories_controller.rb', line 32 def create @post_category = SpudPostCategory.new(params[:spud_post_category]) if @post_category.save flash[:notice] = 'Post Category was successfully created' expire_post_actions end respond_with @post_category, :location => spud_admin_post_categories_path end |
#destroy ⇒ Object
41 42 43 44 45 46 47 |
# File 'app/controllers/spud/admin/post_categories_controller.rb', line 41 def destroy if @post_category.destroy flash[:notice] = 'Post Category was successfully deleted' expire_post_actions end respond_with @post_category, :location => spud_admin_post_categories_path end |
#edit ⇒ Object
15 16 17 |
# File 'app/controllers/spud/admin/post_categories_controller.rb', line 15 def edit respond_with @post_category end |
#index ⇒ Object
10 11 12 13 |
# File 'app/controllers/spud/admin/post_categories_controller.rb', line 10 def index @post_categories = SpudPostCategory.order('name asc').includes(:posts).paginate(:page => params[:page], :per_page => 15) respond_with @post_categories end |
#new ⇒ Object
27 28 29 30 |
# File 'app/controllers/spud/admin/post_categories_controller.rb', line 27 def new @post_category = SpudPostCategory.new respond_with @post_category end |
#update ⇒ Object
19 20 21 22 23 24 25 |
# File 'app/controllers/spud/admin/post_categories_controller.rb', line 19 def update if @post_category.update_attributes(params[:spud_post_category]) flash[:notice] = 'Post Category was successfully updated' expire_post_actions end respond_with @post_category, :location => spud_admin_post_categories_path end |