Continue adding product variants

This commit is contained in:
2015-04-13 17:57:06 +02:00
parent 6746eaa383
commit 2b036368cf
32 changed files with 169 additions and 12224 deletions
+3 -1
View File
@@ -5,6 +5,7 @@ class ProductOrder
property :quantity, type: Fixnum
property :price, type: Float
property :product_name
property :product_variant
belongs_to :product
belongs_to :order
@@ -14,7 +15,8 @@ class ProductOrder
# Getter for product name. If a supplier deletes a product, that has product_orders, the product
# will become nil. This method should handle this case.
alias_method :direct_product_name, :product_name
def product_name
product.try(:name) || '[deleted]'
direct_product_name.presence || product.try(:name) || '[deleted]'
end
end