Class: Admin::BlogCategoriesController
- Inherits:
-
ApplicationController
- Object
- ApplicationController
- Admin::BlogCategoriesController
- Defined in:
- app/controllers/admin/blog_categories_controller.rb
Instance Method Summary collapse
- #create ⇒ Object
- #destroy ⇒ Object
- #edit ⇒ Object
- #index ⇒ Object
- #new ⇒ Object
- #show ⇒ Object
- #update ⇒ Object
Instance Method Details
#create ⇒ Object
16 17 18 19 20 21 22 23 24 |
# File 'app/controllers/admin/blog_categories_controller.rb', line 16 def create @blog_category = BlogCategory.new params[:blog_category] if @blog_category.save flash[:notice] = 'Successfully created the blog_category.' redirect_to @blog_category.root? ? admin_blog_category_path(@blog_category) : admin_blog_category_path(@blog_category.parent) else render :action => 'new' end end |
#destroy ⇒ Object
38 39 40 41 42 |
# File 'app/controllers/admin/blog_categories_controller.rb', line 38 def destroy @blog_category.destroy flash[:notice] = 'Successfully destroyed the blog_category.' redirect_to @blog_category.root? ? admin_blog_categories_path : admin_blog_category_path(@blog_category.parent) end |
#edit ⇒ Object
26 27 |
# File 'app/controllers/admin/blog_categories_controller.rb', line 26 def edit end |
#index ⇒ Object
5 6 7 |
# File 'app/controllers/admin/blog_categories_controller.rb', line 5 def index @blog_categories = BlogCategory.roots end |
#new ⇒ Object
12 13 14 |
# File 'app/controllers/admin/blog_categories_controller.rb', line 12 def new @blog_category = BlogCategory.new :parent_id => params[:parent_id] end |
#show ⇒ Object
9 10 |
# File 'app/controllers/admin/blog_categories_controller.rb', line 9 def show end |
#update ⇒ Object
29 30 31 32 33 34 35 36 |
# File 'app/controllers/admin/blog_categories_controller.rb', line 29 def update if @blog_category.update_attributes params[:blog_category] flash[:notice] = 'Successfully updated the blog_category.' redirect_to admin_blog_categories_path else render :action => 'edit' end end |