Class: SimpleForum::Admin::CategoriesController
- Inherits:
-
BaseController
- Object
- ApplicationController
- SimpleForum::ApplicationController
- BaseController
- SimpleForum::Admin::CategoriesController
- Defined in:
- app/controllers/simple_forum/admin/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
26 27 28 29 30 31 32 33 34 35 36 37 38 |
# File 'app/controllers/simple_forum/admin/categories_controller.rb', line 26 def create success = resource.save respond_with([:admin, resource]) do |format| format.html do if success redirect_to [:admin, resource] else render :new end end end end |
#destroy ⇒ Object
54 55 56 57 58 |
# File 'app/controllers/simple_forum/admin/categories_controller.rb', line 54 def destroy resource.destroy respond_with([:admin, resource]) end |
#edit ⇒ Object
16 17 18 19 |
# File 'app/controllers/simple_forum/admin/categories_controller.rb', line 16 def edit respond_with([:admin, resource]) end |
#index ⇒ Object
5 6 7 8 9 |
# File 'app/controllers/simple_forum/admin/categories_controller.rb', line 5 def index @categories = SimpleForum::Category.default_order.all respond_with(@categories) end |
#new ⇒ Object
21 22 23 24 |
# File 'app/controllers/simple_forum/admin/categories_controller.rb', line 21 def new respond_with([:admin, resource]) end |
#show ⇒ Object
11 12 13 14 |
# File 'app/controllers/simple_forum/admin/categories_controller.rb', line 11 def show respond_with([:admin, resource]) end |
#update ⇒ Object
40 41 42 43 44 45 46 47 48 49 50 51 52 |
# File 'app/controllers/simple_forum/admin/categories_controller.rb', line 40 def update success = resource.update_attributes(params[:category]) respond_with([:admin, resource]) do |format| format.html do if success redirect_to [:admin, resource] else render :edit end end end end |