diff --git a/app/controllers/investments_controller.rb b/app/controllers/investments_controller.rb index 1ef7d144b..5fa25f123 100644 --- a/app/controllers/investments_controller.rb +++ b/app/controllers/investments_controller.rb @@ -1,3 +1,5 @@ class InvestmentsController < ApplicationController include AccountableResource + + permitted_accountable_attributes :id, :subtype end diff --git a/app/views/investments/_form.html.erb b/app/views/investments/_form.html.erb index 4fc706e33..be4004d27 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 %>