The personal finance app for everyone
Fix Merchants controller (#704)
Zach Gollwitzer75cdddc6cae2
diff --git a/app/controllers/transactions/merchants_controller.rb b/app/controllers/transactions/merchants_controller.rbindex 2d0dd2ce..2025a6d0 100644--- a/app/controllers/transactions/merchants_controller.rb+++ b/app/controllers/transactions/merchants_controller.rb@@ -10,22 +10,16 @@ class Transactions::MerchantsController < ApplicationControllerenddef create- if Current.family.transaction_merchants.create(merchant_params)- redirect_to transaction_merchants_path, notice: t(".success")- else- render transaction_merchants_path, status: :unprocessable_entity, notice: t(".error")- end+ Current.family.transaction_merchants.create!(merchant_params)+ redirect_to transaction_merchants_path, notice: t(".success")enddef editenddef update- if @merchant.update(merchant_params)- redirect_to transaction_merchants_path, notice: t(".success")- else- render transaction_merchants_path, status: :unprocessable_entity, notice: t(".error")- end+ @merchant.update!(merchant_params)+ redirect_to transaction_merchants_path, notice: t(".success")enddef destroydiff --git a/config/locales/views/transaction/en.yml b/config/locales/views/transaction/en.ymlindex 2f4de9df..12e2e841 100644--- a/config/locales/views/transaction/en.yml+++ b/config/locales/views/transaction/en.yml@@ -59,7 +59,6 @@ en:edit_categories: Edit categoriesmerchants:create:- error: Error creating merchantsuccess: New merchant created successfullydestroy:success: Merchant deleted successfully@@ -84,7 +83,6 @@ en:new:title: New merchantupdate:- error: Error updating merchantsuccess: Merchant updated successfullyupdate:success: Transaction updated successfully