foodsoft/app/controllers/admin/financial_transaction_classes_controller.rb
Philipp Rothmann fb2b4d8a8a chore: rubocop
chore: fix api test conventions

chore: rubocop -A spec/

chore: more rubocop -A

fix failing test

rubocop fixes

removes helper methods that are in my opinion dead code

more rubocop fixes

rubocop -a --auto-gen-config
2023-06-09 17:35:05 +02:00

41 lines
1.3 KiB
Ruby

class Admin::FinancialTransactionClassesController < Admin::BaseController
inherit_resources
def new
@financial_transaction_class = FinancialTransactionClass.new(params[:financial_transaction_class])
render layout: false
end
def edit
@financial_transaction_class = FinancialTransactionClass.find(params[:id])
render action: 'new', layout: false
end
def create
@financial_transaction_class = FinancialTransactionClass.new(params[:financial_transaction_class])
if @financial_transaction_class.save
redirect_to update_transaction_types_admin_finances_url, status: :see_other
else
render action: 'new', layout: false
end
end
def update
@financial_transaction_class = FinancialTransactionClass.find(params[:id])
if @financial_transaction_class.update(params[:financial_transaction_class])
redirect_to update_transaction_types_admin_finances_url, status: :see_other
else
render action: 'new', layout: false
end
end
def destroy
@financial_transaction_class = FinancialTransactionClass.find(params[:id])
@financial_transaction_class.destroy!
redirect_to update_transaction_types_admin_finances_url, status: :see_other
rescue StandardError => e
flash.now[:alert] = e.message
render template: 'shared/alert'
end
end