From 25985a262901794032496a84c5dc9d0a957badd8 Mon Sep 17 00:00:00 2001 From: viehlieb Date: Tue, 21 Feb 2023 15:18:11 +0100 Subject: [PATCH] add price_per to localiced input --- app/models/article.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/models/article.rb b/app/models/article.rb index 76a68605..a9449e87 100644 --- a/app/models/article.rb +++ b/app/models/article.rb @@ -51,7 +51,7 @@ class Article < ApplicationRecord has_many :orders, through: :order_articles # Replace numeric seperator with database format - localize_input_of :price, :tax, :deposit + localize_input_of :price, :tax, :deposit, :price_per # Get rid of unwanted whitespace. {Unit#new} may even bork on whitespace. normalize_attributes :name, :unit, :note, :manufacturer, :origin, :order_number @@ -152,6 +152,7 @@ class Article < ApplicationRecord :price => [self.price.to_f.round(2), new_price.to_f.round(2)], :tax => [self.tax, new_article.tax], :deposit => [self.deposit.to_f.round(2), new_article.deposit.to_f.round(2)], + :price_per => [self.price_per.to_f.round(2), new_article.price_per.to_f.round(2)], # take care of different num-objects. :unit_quantity => [self.unit_quantity.to_s.to_f, new_unit_quantity.to_s.to_f], :note => [self.note.to_s, new_article.note.to_s]