The personal finance app for everyone (by everyone)
Ruby
Fix Investment account subtype not saving on creation (#1039)
Duc-Thomas7e912c1c934b
diff --git a/app/controllers/investments_controller.rb b/app/controllers/investments_controller.rbindex 1ef7d144b1..5fa25f1232 100644--- a/app/controllers/investments_controller.rb+++ b/app/controllers/investments_controller.rb@@ -1,3 +1,5 @@class InvestmentsController < ApplicationControllerinclude AccountableResource++ permitted_accountable_attributes :id, :subtypeenddiff --git a/app/views/investments/_form.html.erb b/app/views/investments/_form.html.erbindex 4fc706e33d..be4004d271 100644--- a/app/views/investments/_form.html.erb+++ b/app/views/investments/_form.html.erb@@ -1,7 +1,9 @@<%# locals: (account:, url:) %><%= render "accounts/form", account: account, url: url do |form| %>- <%= form.select :subtype,- grouped_options_for_select(Investment.subtypes_grouped_for_select(currency: Current.family.currency), account.subtype),- { label: true, prompt: t("investments.form.subtype_prompt"), include_blank: t("investments.form.none") } %>+ <%= form.fields_for :accountable do |investment_form| %>+ <%= investment_form.select :subtype,+ grouped_options_for_select(Investment.subtypes_grouped_for_select(currency: Current.family.currency), account.accountable.subtype),+ { label: true, prompt: t("investments.form.subtype_prompt"), include_blank: t("investments.form.none") } %>+ <% end %><% end %>