Class: Admin::SupplierCategoriesController
- Inherits:
-
BaseController
- Object
- BaseController
- Admin::SupplierCategoriesController
- Defined in:
- app/controllers/admin/supplier_categories_controller.rb
Instance Method Summary collapse
Instance Method Details
#create ⇒ Object
14 15 16 17 18 19 20 21 |
# File 'app/controllers/admin/supplier_categories_controller.rb', line 14 def create @supplier_category = SupplierCategory.new(params[:supplier_category]) if @supplier_category.valid? && @supplier_category.save redirect_to update_supplier_categories_admin_finances_url, status: :see_other else render action: 'new', layout: false end end |
#destroy ⇒ Object
33 34 35 36 37 38 39 40 |
# File 'app/controllers/admin/supplier_categories_controller.rb', line 33 def destroy @supplier_category = SupplierCategory.find(params[:id]) @supplier_category.destroy redirect_to update_supplier_categories_admin_finances_url, status: :see_other rescue StandardError => e flash.now[:alert] = e. render template: 'shared/alert' end |
#edit ⇒ Object
9 10 11 12 |
# File 'app/controllers/admin/supplier_categories_controller.rb', line 9 def edit @supplier_category = SupplierCategory.find(params[:id]) render action: 'new', layout: false end |
#new ⇒ Object
4 5 6 7 |
# File 'app/controllers/admin/supplier_categories_controller.rb', line 4 def new @supplier_category = SupplierCategory.new(params[:supplier_category]) render layout: false end |
#update ⇒ Object
23 24 25 26 27 28 29 30 31 |
# File 'app/controllers/admin/supplier_categories_controller.rb', line 23 def update @supplier_category = SupplierCategory.find(params[:id]) if @supplier_category.update(params[:supplier_category]) redirect_to update_supplier_categories_admin_finances_url, status: :see_other else render action: 'new', layout: false end end |