The personal finance app for everyone
Add initial list of valid account types
Rob Zolkosf1909b3bf26d
diff --git a/app/controllers/accounts_controller.rb b/app/controllers/accounts_controller.rbindex 18d6106e..44b1aff9 100644--- a/app/controllers/accounts_controller.rb+++ b/app/controllers/accounts_controller.rb@@ -33,9 +33,7 @@ class AccountsController < ApplicationControllerenddef account_type_class- valid_account_types = %w[Checking CreditCard]-- if params[:type].present? && valid_account_types.include?(params[:type])+ if params[:type].present? && Account::VALID_ACCOUNT_TYPES.include?(params[:type])params[:type].constantizeselseAccount # Default to Account if type is not provided or invaliddiff --git a/app/models/account.rb b/app/models/account.rbindex 9f130896..73a8b482 100644--- a/app/models/account.rb+++ b/app/models/account.rb@@ -1,3 +1,5 @@class Account < ApplicationRecordbelongs_to :family++ VALID_ACCOUNT_TYPES = %w[Investment Depository Credit Loan Property Vehicle OtherAsset OtherLiability].freezeend