diff --git a/app/controllers/accounts_controller.rb b/app/controllers/accounts_controller.rb index db54d17c..11b55ac6 100644 --- a/app/controllers/accounts_controller.rb +++ b/app/controllers/accounts_controller.rb @@ -58,8 +58,6 @@ class AccountsController < ApplicationController start_balance: account_params[:start_balance] @account.sync_later redirect_back_or_to account_path(@account), notice: t(".success") - rescue ActiveRecord::RecordInvalid => e - redirect_back_or_to accounts_path, alert: e.record.errors.full_messages.to_sentence end def destroy diff --git a/app/helpers/forms_helper.rb b/app/helpers/forms_helper.rb index 19f75b29..c5d3d5d5 100644 --- a/app/helpers/forms_helper.rb +++ b/app/helpers/forms_helper.rb @@ -34,7 +34,8 @@ module FormsHelper default_currency: options[:default_currency] || "USD", disable_currency: options[:disable_currency] || false, hide_currency: options[:hide_currency] || false, - label: options[:label] || "Amount" + label: options[:label] || "Amount", + required: options[:required] || false } end diff --git a/app/views/accounts/_form.html.erb b/app/views/accounts/_form.html.erb index 86ee96bd..ad537264 100644 --- a/app/views/accounts/_form.html.erb +++ b/app/views/accounts/_form.html.erb @@ -5,7 +5,7 @@ <%= f.hidden_field :accountable_type %> <%= f.text_field :name, placeholder: t(".name_placeholder"), required: "required", label: t(".name_label"), autofocus: true %> <%= f.collection_select :institution_id, Current.family.institutions.alphabetically, :id, :name, { include_blank: t(".ungrouped"), label: t(".institution") } %> - <%= money_with_currency_field f, :balance_money, label: t(".balance"), required: "required", default_currency: Current.family.currency %> + <%= money_with_currency_field f, :balance_money, label: t(".balance"), required: true, default_currency: Current.family.currency %> <% if account.new_record? %>