Class: Admin::CategoriesController
- Inherits:
-
ApplicationController
- Object
- ApplicationController
- Admin::CategoriesController
- Defined in:
- app/controllers/cornerstone/admin/categories_controller.rb
Instance Method Summary collapse
-
#create ⇒ Object
POST /cornerstone/admin/categories/.
-
#destroy ⇒ Object
DELETE /cornerstone/admin/categories/:id.
-
#edit ⇒ Object
GET /cornerstone/admin/categories/:id/edit.
- #index ⇒ Object
-
#new ⇒ Object
GET /cornerstone/admin/categories/new.
-
#update ⇒ Object
PUT /cornerstone/admin/categories/:id.
Instance Method Details
#create ⇒ Object
POST /cornerstone/admin/categories/
18 19 20 21 22 |
# File 'app/controllers/cornerstone/admin/categories_controller.rb', line 18 def create @category = Category.new(params[:category]) flash[:notice] = 'Category was successfully created.' if @category.save respond_with(:admin, @category, :location => admin_categories_path) end |
#destroy ⇒ Object
DELETE /cornerstone/admin/categories/:id
38 39 40 41 42 |
# File 'app/controllers/cornerstone/admin/categories_controller.rb', line 38 def destroy @category = Category.find(params[:id]) flash[:notice] = 'Category was successfully destroyed.' if @category.destroy respond_with([:admin, @category], :location => admin_categories_path) end |
#edit ⇒ Object
GET /cornerstone/admin/categories/:id/edit
25 26 27 28 |
# File 'app/controllers/cornerstone/admin/categories_controller.rb', line 25 def edit @category = Category.find(params[:id]) respond_with(:admin, @category) end |
#index ⇒ Object
6 7 8 9 |
# File 'app/controllers/cornerstone/admin/categories_controller.rb', line 6 def index @discussion_categories = Category.discussions @article_categories = Category.articles end |
#new ⇒ Object
GET /cornerstone/admin/categories/new
12 13 14 15 |
# File 'app/controllers/cornerstone/admin/categories_controller.rb', line 12 def new @category = Category.new respond_with(:admin, @category) end |
#update ⇒ Object
PUT /cornerstone/admin/categories/:id
31 32 33 34 35 |
# File 'app/controllers/cornerstone/admin/categories_controller.rb', line 31 def update @category = Category.find(params[:id]) flash[:notice] = 'Category was successfully updated.' if @category.update_attributes(params[:category]) respond_with(:admin, @category, :location => admin_categories_path) end |