Class: Admin::FinancialTransactionTypesController
- Inherits:
-
BaseController
- Object
- BaseController
- Admin::FinancialTransactionTypesController
- Defined in:
- app/controllers/admin/financial_transaction_types_controller.rb
Instance Method Summary collapse
Instance Method Details
#create ⇒ Object
15 16 17 18 19 20 21 22 |
# File 'app/controllers/admin/financial_transaction_types_controller.rb', line 15 def create @financial_transaction_type = FinancialTransactionType.new(params[:financial_transaction_type]) if @financial_transaction_type.save redirect_to update_transaction_types_admin_finances_url, status: :see_other else render action: 'new', layout: false end end |
#destroy ⇒ Object
34 35 36 37 38 39 40 41 |
# File 'app/controllers/admin/financial_transaction_types_controller.rb', line 34 def destroy @financial_transaction_type = FinancialTransactionType.find(params[:id]) @financial_transaction_type.destroy! redirect_to update_transaction_types_admin_finances_url, status: :see_other rescue StandardError => e flash.now[:alert] = e. render template: 'shared/alert' end |
#edit ⇒ Object
10 11 12 13 |
# File 'app/controllers/admin/financial_transaction_types_controller.rb', line 10 def edit @financial_transaction_type = FinancialTransactionType.find(params[:id]) render action: 'new', layout: false end |
#new ⇒ Object
4 5 6 7 8 |
# File 'app/controllers/admin/financial_transaction_types_controller.rb', line 4 def new @financial_transaction_type = FinancialTransactionType.new(params[:financial_transaction_type]) @financial_transaction_type.financial_transaction_class = FinancialTransactionClass.find_by_id(params[:financial_transaction_class]) if params[:financial_transaction_class] render layout: false end |
#update ⇒ Object
24 25 26 27 28 29 30 31 32 |
# File 'app/controllers/admin/financial_transaction_types_controller.rb', line 24 def update @financial_transaction_type = FinancialTransactionType.find(params[:id]) if @financial_transaction_type.update(params[:financial_transaction_type]) redirect_to update_transaction_types_admin_finances_url, status: :see_other else render action: 'new', layout: false end end |