number_to_currency can be nil: use a safe operator

This commit is contained in:
Jean-Baptiste Bellet
2023-06-29 10:47:00 +02:00
parent 8b3f45263c
commit 3286094804

View File

@@ -23,7 +23,7 @@
= f.text_field :sku, class: 'fullwidth'
.field
= f.label :price, t('.price')
= f.text_field :price, class: 'fullwidth', "ng-model" => "variant.price", "ng-init" => "variant.price = '#{number_to_currency(@variant.price, unit: '').strip}'"
= f.text_field :price, class: 'fullwidth', "ng-model" => "variant.price", "ng-init" => "variant.price = '#{number_to_currency(@variant.price, unit: '')&.strip}'"
.field
= hidden_field_tag 'product_variant_unit', @product.variant_unit
= hidden_field_tag 'product_variant_unit_name', @product.variant_unit_name