Class: Admin::CategoriesController
- Inherits:
-
AdminController
- Object
- AdminController
- Admin::CategoriesController
- Defined in:
- app/controllers/formol/admin/categories_controller.rb
Instance Method Summary collapse
- #create ⇒ Object
- #destroy ⇒ Object
- #edit ⇒ Object
- #index ⇒ Object
- #new ⇒ Object
- #sort ⇒ Object
- #update ⇒ Object
Instance Method Details
#create ⇒ Object
14 15 16 17 18 19 20 21 22 |
# File 'app/controllers/formol/admin/categories_controller.rb', line 14 def create if category.save respond_with(category, :status => :created, :location => admin_categories_path) else respond_with(category, :status => :unprocessable_entity) do |format| format.html { render :new } end end end |
#destroy ⇒ Object
38 39 40 41 42 |
# File 'app/controllers/formol/admin/categories_controller.rb', line 38 def destroy category.destroy respond_with(category, :location => admin_categories_path) end |
#edit ⇒ Object
24 25 26 |
# File 'app/controllers/formol/admin/categories_controller.rb', line 24 def edit category end |
#index ⇒ Object
6 7 8 |
# File 'app/controllers/formol/admin/categories_controller.rb', line 6 def index categories end |
#new ⇒ Object
10 11 12 |
# File 'app/controllers/formol/admin/categories_controller.rb', line 10 def new category end |
#sort ⇒ Object
44 45 46 47 48 |
# File 'app/controllers/formol/admin/categories_controller.rb', line 44 def sort Formol::Category.sort(params[:categories]) render :nothing => true, :status => :ok end |
#update ⇒ Object
28 29 30 31 32 33 34 35 36 |
# File 'app/controllers/formol/admin/categories_controller.rb', line 28 def update if category.update_attributes(params[:category]) respond_with(category, :location => admin_categories_path) else respond_with(category) do |format| format.html { render :edit } end end end |