diff --git a/app/controllers/admin/invoices_controller.rb b/app/controllers/admin/invoices_controller.rb index 68db492d8c..2232576053 100644 --- a/app/controllers/admin/invoices_controller.rb +++ b/app/controllers/admin/invoices_controller.rb @@ -7,8 +7,8 @@ def new end def create - r = Registrar.find_by(id: deposit_params[:registrar_id]) - @deposit = Deposit.new(deposit_params.merge(registrar: r)) + registrar = Registrar.find(deposit_params[:registrar_id]) + @deposit = Deposit.new(deposit_params.merge(registrar: registrar)) @invoice = @deposit.issue_prepayment_invoice if @invoice&.persisted? diff --git a/app/views/admin/invoices/new.haml b/app/views/admin/invoices/new.haml index 920b11903c..f688cfe046 100644 --- a/app/views/admin/invoices/new.haml +++ b/app/views/admin/invoices/new.haml @@ -12,7 +12,7 @@ .col-md-4.control-label = f.label :registrar_id, class: 'required' .col-md-8 - = f.select :registrar_id, Registrar.all.map { |r| [r.name, r.id] }, { include_blank: true }, class: 'form-control selectize', required: true + = select_tag 'deposit[registrar_id]', options_for_select(Registrar.all.map { |r| [r.name, r.id] }), { prompt: t(:choose), required: true, class: 'form-control js-combobox' } .form-group .col-md-4.control-label