Continue adding product variants
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user